Move n characters in front of given string to the end of string time complexity: O(n) space complexity: O(n) @param s given string @param n the total characters to be moved @return string after rotation
(String s, int n)
| 27 | * @return string after rotation |
| 28 | */ |
| 29 | public static String rotation(String s, int n) { |
| 30 | return s.substring(n) + s.substring(0, n); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Move {@code n} characters in front of given character array to the end of |