strategies to puzzles
Andy Chen
Posted on July 28, 2021
Palindroms
- recursion
- stringmanipulation
string.replace(/[^A-Za-z0-9]/g, '') gets rid of spaces
string.split('').reverse().join('')
- for loops
for loops for (var i = 0; i < len / 2; i++) { if (characters[i] !== characters[len - 1 - i]) return false; }
Reversing strings = 1) reverse
2) decrementing for loop
3) recursion with substr and charAt
Binary Search.. linkedlist ... etc to come
💖 💪 🙅 🚩
Andy Chen
Posted on July 28, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.