cracking-the-coding-interview
cracking-the-coding-interview copied to clipboard
Incorrect code in string rotation
https://github.com/Turingfly/cracking-the-coding-interview/blob/efe6d6c5d7d57e64ec876d648e15cf79f98a014f/src/chapter01ArraysAndStrings/StringRotation.java#L15
current implementation always returns true, even if s2 contains all different characters: isRotation("abcd", "1234") -> true
it should be:
return isSubstring((s1 + s1), s2);