We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d6c9dc6 commit 8c54c74Copy full SHA for 8c54c74
String/AlphaNumericPalindrome.js
@@ -21,7 +21,7 @@ const alphaNumericPalindrome = (str) => {
21
22
// removing all the special characters and turning everything to lowercase
23
const newStr = str.replace(/[^a-z0-9]+/ig, '').toLowerCase()
24
- const midIndex = newStr.length >> 1 // x >> y = |x| / 2^y
+ const midIndex = newStr.length >> 1 // x >> y = floor(|x| / 2^y)
25
26
for (let i = 0; i < midIndex; i++) {
27
if (newStr.at(i) !== newStr.at(~i)) { // ~n = -(n + 1)
0 commit comments