알고리즘 코드카타
Article Views I
select distinct author_id as id
from Views
where author_id = viewer_id
order by author_id asc;
푸드 파이트 대회
class Solution {
public String solution(int[] food) {
String answer = "";
for(int i = 1; i < food.length; i++){
for(int j = 0; j < food[i]/2; j++){
answer += Integer.toString(i);
}
}
StringBuilder builder = new StringBuilder(answer);
answer += "0" + builder.reverse();
return answer;
}
}
콜라 문제
class Solution {
public int solution(int a, int b, int n) {
int answer = 0;
int coke = n;
int last = 0;
while(true){
last = coke%a;
coke /= a;
answer += coke*b;
coke = coke*b + last;
if(coke < a){
break;
}
}
return answer;
}
}