Sollicitatievragen bij Booking.com: We have two words. We need to... | Glassdoor.nl

Sollicitatievraag

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

Antwoord op sollicitatievraag

3 antwoorden

4

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.

0

http://www.geeksforgeeks.org/anagram-substring-search-search-permutations/

Anonymous Guy op 5 aug. 2017

Voeg antwoorden of opmerkingen toe

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