import java.util.*;
class Solution {
public int solution(int[] d, int budget) {
Arrays.sort(d);
int answer = 0;
for(int i=0; i<d.length; i++){
budget -= d[i];
if(budget < 0) return answer;
answer++;
}
return answer;
}
}
import java.util.*;
class Solution {
public int solution(String s) {
String[] alpha = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
String[] nums = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
for(int i=0; i<10; i++){
if(s.contains(alpha[i])) s=s.replaceAll(alpha[i], nums[i]);
}
return Integer.parseInt(s);
}
}
import java.util.*;
class Solution {
public int[] solution(String[] name, int[] yearning, String[][] photo) {
int[] answer = new int[photo.length];
for(int i=0; i<photo.length; i++){
int count = 0;
for(int j=0; j<photo[i].length; j++){
if(Arrays.asList(name).indexOf(photo[i][j])>=0) count+=yearning[Arrays.asList(name).indexOf(photo[i][j])];
}
answer[i] = count;
}
return answer;
}
}
: 공부의 필요성을 알고는 있었지만 외면하고 있었던 자료구조...
자료구조 모르고 알고리즘 풀면 안 된다는 조언에 따라 자료구조 공부를 시작하기로 했습니다..
책이랑 유튜브 강의로 공부할 예정.
https://www.youtube.com/watch?v=h2_Lc8a8Ffw&list=PLG7te9eYUi7tAQygBknaTciy8wzLCe-Ll&index=13
자료구조랑 알고리즘 진짜 모르겠다😣🥲😱🤯🔫
주말에 놀 계획과 놀 마음이 가득한데, 밤에는 잠깐씩 자료구조 읽어보기라도 하기..
정답률 70%, 60%대의 문제들에 지레 겁먹었는데, 생각보다 할만해서 다음에는 50%대 도전해볼 것.