This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function palindrome(str) { | |
str = str.toLowerCase().replace(/[\W_]/g, ''); | |
for(var i = 0, len = str.length - 1; i < len/2; i++) { | |
if(str[i] !== str[len-i]) { | |
return false; | |
} | |
} | |
return true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Create a function that returns the sum of the two lowest positive numbers | |
given an array of minimum 4 integers. No floats or empty arrays will be | |
passed. | |
For example, when an array is passed like [19, 5, 42, 2, 77], | |
the output should be 7. | |
[10, 343445353, 3453445, 3453545353453] should return 3453455. | |
Hint: Do not modify the original array. """ |