Using a nested for() loop is inefficient, can you do it more efficient than the native String.indexOf() method? Without nesting for loops or recursion.
Antwoorden op sollicitatievragen
Convert the strings to objects with each word being added as a property to speed up the lookup. I had heard of this technique but never done it myself.
sort the words will be done in n Log n . for each word in 1st string do binary search on other string which will run in n log n so overall complexity will be n log n.