Sollicitatievragen bij We have two words. We need to... |


Sollicitatie naar Software Engineer Amsterdam

We have two words. We need to determine if the second word

  contains a substring with an anagram of the first word. ping & jingp -> yes ping & ijngp -> no

Antwoord op sollicitatievraag

3 antwoorden


I've built a function that returns true or false. Used counting of characters in the first word. And frame with size as a first word, that moves over the second word. Then we just simply count character if it's one of the characters that we need to fulfill in our anagram and increase our "common counter/overlap", and doing decreasing for the character from our tail if it was needed character.
Overall run-time complexity: O(len(firstWord) + len(secondWord)), memory: O(len(firstWord)

Sollicitant op 28 dec. 2016

Dit bericht is verwijderd.
Zie onze Gedragscode of Gebruiksvoorwaarden voor meer informatie.


Anonymous Guy op 5 aug. 2017

Voeg antwoorden of opmerkingen toe

Meld u aan of registreer u om hier een opmerking over te maken.