Skip to content

Commit

Permalink
add (programmers - level1 1문제): js 풀이
Browse files Browse the repository at this point in the history
  • Loading branch information
padosum committed Dec 23, 2022
1 parent 8e550d6 commit fc7cbc9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions programmers/level1/크기가 작은 부분문자열.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function solution(t, p) {
const tArr = t.split('')
const pLen = p.length
const tLen = t.length

let result = 0
for (let i = 0; i <= tLen - pLen; i++) {
const somePart = tArr.slice(i, i+pLen).join('')
if (p >= somePart) {
result++
}
}
return result
}

0 comments on commit fc7cbc9

Please sign in to comment.