def solution(t, p):
s = 0
result = 0
# 슬라이싱 + 비교 연산
length1 = len(t)
length2 = len(p)
while s <= length1 - length2 :
if int(t[s:s+len(p)]) <= int(p):
result += 1
s += 1
return result
다른풀이
def solution(t, p):
answer = 0
for i in range(len(t) - len(p) + 1):
if int(p) >= int(t[i:i+len(p)]):
answer += 1
return answer
다른 풀이처럼 슬라이싱을 완벽구현 하는 것이 필요하다...!