πŸ“œ

Ends With

Ends With
쉬움 λ¬Έμžμ—΄ +10pts

Problem

Write a function that checks if a string ends with a given suffix.

Examples

Input: endsWith("hello", "lo")
Output: true

Explanation

이 λ¬Έμ œλŠ” **endsWith() λ©”μ„œλ“œ**둜 λ¬Έμžμ—΄μ˜ 끝을 ν™•μΈν•˜λŠ” 방법을 ν•™μŠ΅ν•©λ‹ˆλ‹€. ## 핡심 κ°œλ…: 접미사 확인 endsWith()λŠ” λ¬Έμžμ—΄μ΄ νŠΉμ • λ¬Έμžμ—΄λ‘œ λλ‚˜λŠ”μ§€ ν™•μΈν•©λ‹ˆλ‹€. ### κΈ°λ³Έ μ‚¬μš©λ²• ```javascript str.endsWith(searchString) str.endsWith(searchString, length) ``` - searchString: 찾을 접미사 - length: 검색할 λ¬Έμžμ—΄ 길이 (κΈ°λ³Έκ°’: str.length) ### ν™œμš© μ˜ˆμ‹œ ```javascript "hello".endsWit...

View detailed explanation β†’

Key Concepts

endsWith λ©”μ„œλ“œ 접미사 확인 파일 ν™•μž₯자 검사 ES6 λ©”μ„œλ“œ
Time: O(m) Space: O(1)
solution.js
Ctrl + Enter
Run tests to see results here.