How to Rotate a String in Java
Rotating a String
in Java is a common interview question, and albeit it quite a simple one, it tests many fundamental concepts. Did I mention that it can also be done fairly quickly too!
Rotating a String in Java
|
|
With the above code, we can rotate a string both left and right, but we don’t take into account any edge cases, exception handling, input validation or out of bounds problems.