publicmays / Cracking-Coding-Interview

3 stars 7 forks source link

In the stringRotation solution you do nothing with rotation variable #1

Open joaogomes44033 opened 7 years ago

joaogomes44033 commented 7 years ago

In the stringRotation solution you do nothing with rotation variable.

boolean stringRotation (String s1, String s2) { if (s1.length() == s2.length() && s1.length() > 0) { StringBuilder rotation = new StringBuilder(); rotation = s1+s1; return s2.isSubstring(s1); } return false; }

It should be:

return s2.isSubstring(rotation);