I used str.startsWith() here, how are we supposed to do this question without it , as this was not covered in the lecture??
or using this is fine?
Using extra stuff!?
Also in the editorial the solutions are mentioned only in c++, please include them in java too
You need to define your own comparator for this problem.
Compare the characters one by one and make sure that i < s1.length() && i < s2.length(). If there exists a prefix, the next ’ if ’ condition will take care of it.
https://ide.codingblocks.com/s/288209 You can refer to the Java solution here.
Thanks got it! …