You are viewing a single comment's thread. Return to all comments →
here's the proof:
even + even = even odd + odd = even odd + even = odd
if the string length is even then it must have an even number of odd substrings, meaning 0, 2, 4... Otherwise the length would be odd.
this means that a correct test for the odd length should also catch valid even length strings.
Seems like cookies are disabled on this browser, please enable them to open this website
Game of Thrones - I
You are viewing a single comment's thread. Return to all comments →
here's the proof:
even + even = even
odd + odd = even
odd + even = odd
if the string length is even then it must have an even number of odd substrings, meaning 0, 2, 4... Otherwise the length would be odd.
this means that a correct test for the odd length should also catch valid even length strings.