사용언어 : Java
문제

풀이
/*
각 배열의 원소마다 %10해서 한자리씩 7인지 비교
100 * 7(100000 % 10 = 7번)
*/
class Solution {
public int solution(int[] array) {
int temp = 0;
int answer = 0;
for(int i = 0 ; i < array.length; i++)
{
temp = array[i];
System.out.println(temp);
while(temp > 0)
{
int cur = temp % 10;
System.out.println(cur);
if(cur == 7)answer++;
temp /= 10;
}
}
return answer;
}
}
Share article