This common code is said to run in O(N) time assuming isSubstring runs in O(N+M) time. How do we get O(N) time complexity from this?
public static boolean isRotation(String s1, String s2) {
int len = s1.length();
if (len == s2.length() && len > 0) {
String s1s1 = s1 + s1;
return isSubstring(s1s1, s2);
}
return false;
}
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)