Skip to content

Latest commit

 

History

History
19 lines (17 loc) · 506 Bytes

File metadata and controls

19 lines (17 loc) · 506 Bytes

프로그래머스 Level1 : 크기가 작은 부분 문자열

class Solution {
    public int solution(String t, String p) {
        int answer = 0;
        int size = p.length();
        for(int i=0; i<t.length()-size+1; i++){
            String sub = t.substring(i,i+size);
            if (Long.parseLong(sub)<=Long.parseLong(p)){
                answer++;
            }
        }
        return answer;
    }
}