728x90
SMALL

using System;

public class Solution {
    public int solution(int[] array) {
        int answer = 0;
        
        for(int i=0;i<array.Length;i++)
        {
            while(array[i]>10)
            {
                if(array[i]%10 == 7)
                {
                    answer++;
                }
                array[i] = array[i]/10;
            }
            
            if(array[i]%10 == 7)
            {
                answer++;
            }
        }
        
        return answer;
    }
}

 

///

 

using System;

public class Solution {
    public int solution(int[] array) {
        int answer = 0;
        
        foreach(int i in array)
        {
            int temp = i;
            while(temp > 0)
            {
                if(temp%10 == 7)
                    answer++;
                    
                temp /= 10;
            }
        }
        return answer;
    }
}

 

파이썬

/////

 

def solution(array):
    return str(array).count('7')

 

자바

//////

 

class Solution {
    public int solution(int[] array) {
        int answer = 0;
        
        for(int a : array)
        {
            while(a != 0)
            {
                if(a % 10 == 7)
                {
                    answer++;
                }
                
                a /= 10;
            }
        }
        return answer;
    }
}

 

728x90

설정

트랙백

댓글