MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / isPalindrome

Function isPalindrome

javascript/0125-valid-palindrome.js:8–15  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

6 * @return {boolean}
7 */
8var isPalindrome = function (s) {
9 if (!s.length) return true;
10
11 const alphaNumeric = filterAlphaNumeric(s); /* Time O(N) | Space O(N) */
12 const reversed = reverse(alphaNumeric); /* Time O(N) | Space O(N) */
13
14 return alphaNumeric === reversed;
15};
16
17const filterAlphaNumeric = (
18 s,

Callers

nothing calls this directly

Calls 3

filterAlphaNumericFunction · 0.85
isAlphaNumericFunction · 0.85
reverseFunction · 0.70

Tested by

no test coverage detected