Sollicitatievraag
Sollicitatiegesprek voor de functie Software Engineer - Front-End, User Experience, Javascript
-
GoDaddyUsing 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
2 antwoorden
▲
0
▼
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.
Anoniem op
▲
0
▼
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.
Amey op
Voeg antwoorden of opmerkingen toe
Meld u aan of registreer u om hier een opmerking over te maken.