Check the condition in your for loop again.
Yup. Note the second for-loop. It's not optimized, though. Depending on the string's length, sorting and a single iteration could be faster (O(n log n) vs O(n²)).
for
It's not checking only letters next to each other. For each letter, it checks the rest of the letters of the word to find a matching one.
This comment is hidden because it contains spoiler information about the solution
Loading collection data...
Check the condition in your for loop again.
Yup. Note the second
for
-loop. It's not optimized, though. Depending on the string's length, sorting and a single iteration could be faster (O(n log n) vs O(n²)).It's not checking only letters next to each other. For each letter, it checks the rest of the letters of the word to find a matching one.
This comment is hidden because it contains spoiler information about the solution