JAVA/프로그래머스
[프로그래머스/자바] 크기가 작은
동백05
2024. 1. 22. 21:50
https://school.programmers.co.kr/learn/courses/30/lessons/147355
class Solution {
public int solution(String t, String p) {
int answer = 0;
int length = p.length();
Long number = Long.parseLong(p);
for(int i=0;i<(t.length()-length)+1;i++){
if(Long.parseLong(t.substring(i,i+length))<=number){
answer++;
}
}
return answer;
}
}