프로그래머스 - 크기가 작은 부분문자열[JS]

2022. 12. 23. 21:19·알고리즘(Algorithm)
728x90
반응형

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring

 

String.prototype.substring() - JavaScript | MDN

The substring() method returns the part of the string from the start index up to and excluding the end index, or to the end of the string if no end index is supplied.

developer.mozilla.org

 

function solution(t, p) {
  let pLen=p.length;
  let tLen=t.length;
  let sliceStr=t
  let res=[]
  for(let i=0; i < tLen-pLen+1; i++) {
    res.push(sliceStr.substring(i,pLen+i))
  }
  res=res.filter((i)=>(Number(i)<=Number(p)))
  return res.length
}
728x90
반응형
저작자표시 (새창열림)

'알고리즘(Algorithm)' 카테고리의 다른 글

프로그래머스 - 숫자 문자열과 영단어 [JS][2021 카카오 인턴]  (0) 2023.01.05
프로그래머스 - 모의고사 [JS]  (0) 2022.12.30
프로그래머스 - 문자열 나누기[JS]  (1) 2022.12.19
프로그래머스 - 가장 가까운 글자 [JS]  (1) 2022.12.18
프로그래머스 시저 암호 [JS]  (0) 2022.12.17
'알고리즘(Algorithm)' 카테고리의 다른 글
  • 프로그래머스 - 숫자 문자열과 영단어 [JS][2021 카카오 인턴]
  • 프로그래머스 - 모의고사 [JS]
  • 프로그래머스 - 문자열 나누기[JS]
  • 프로그래머스 - 가장 가까운 글자 [JS]
Hun-bot
Hun-bot
IT를 중심으로 다양한 것
  • Hun-bot
    로봇이 만드는 눈사람
    Hun-bot
  • 전체
    오늘
    어제
    • All Article (128)
      • Programmers (6)
        • TIP (1)
        • SQL (2)
        • LV1 (1)
        • LV2 (2)
        • LV3 (0)
      • Baekjoon (31)
        • Bronze (10)
        • Silver (19)
        • Gold (2)
        • Platinum (0)
        • Diamond (0)
      • Leetcode (0)
        • Easy (0)
        • Medium (0)
        • Hard (0)
        • SQL (0)
      • 알고리즘(Algorithm) (42)
      • JavaScript (40)
      • Linux (7)
      • JSP (1)
  • 블로그 메뉴

    • 링크

    • 공지사항

    • 인기 글

    • 태그

      Programmers
      JavaScript #Set #Collection
      JS #javascript #객체 #Object
      백준
      Vue #Vue.js #정리
      알고리즘
      LeetCode #JS #Javascript #Algorithm
      c++
      JSP #Vscode #톰켓 #Tomcat #Java #Web #jdk
      자바스크립트
      BaekJoon
      알고리즘 #Algorithm
      JS #클래스
      JS #프로그래머스 #숫자의표현 #알고리즘
      JS #정규표현식
      Python #알고리즘
      프로그래머스 #자바스크립트 #JS
      오블완
      async await #js #문법 #자바스크립트 #비동기
      프로그래머스
      리눅스
      JS #JavaScript #프로그래머스 #알고리즘
      Javascript
      Algorithm
      JS #JavaScript #프로그래머스 #카카오
      고득점 Kit
      티스토리챌린지
      자바스크립트 #연습문제
      리눅스 #입문
      SQL
    • 최근 댓글

    • hELLO· Designed By정상우.v4.10.3
    Hun-bot
    프로그래머스 - 크기가 작은 부분문자열[JS]
    상단으로

    티스토리툴바

    티스토리툴바