1) 부족한 금액 계산하기
class Solution {
public long solution(int price, int money, int count) {
long answer = money;
for(int i=1; i<=count; i++){
answer = answer - (price*i);
}
if(answer>0){
return 0;
}
return Math.abs(answer);
}
}
2) 문자열 다루기 기본
class Solution {
public boolean solution(String s) {
boolean answer = false;
char[] charS = s.toCharArray();
int temp = 0;
if(s.length() == 4 || s.length() == 6){
for(int i=0; i<charS.length; i++){
if(charS[i]>47 && charS[i]<58){
temp++;
}
}
}
if(temp == charS.length){
answer = true;
}
return answer;
}
}