Write a function to check if a string is a rotation of another string.
Let the given two strings are \( string1 \) and \( string2 \). We have to check whether \( string2 \) is a rotation of \( string1 \). The algorithm works as :
Example - `\( queuealgo \)' is a rotation of `\( algoqueue \)'. Time complexity = \( O(n^{2}) \). public static boolean checkStringRotation(String string1, String string2){ < Faster solution > Linear time : public boolean checkStringRotation(String string1, String string2){ Time complexity = \( O(n) \). |