I'm trying to write a method that get two strings and checks if its able to substring them to get the same string. for example if s1 = "abc" and s2 = "abbbc" it will return true. I want to do it in BackTracking recursion.
here is my code that isn't working:
private static boolean isTrue(String s1, String s2) {
boolean right= false;
if(s1 == s2)
right = true;
else {
if(s1.length() > 0 && s2.length() > 0) {
right = isTrue(s1, s2.substring(1)) || isTrue(s1.substring(1), s2.substring(1));
}
}
return right;
}
some help please?