0

Find duplicate word in any string

How would I be able to detect a duplicate word in any string given. example 'isonetoismany', detect the duplicate "is" and return true for finding a duplicate and false if none.

16th Jan 2018, 12:07 AM
Bryce Simmons
Bryce Simmons - avatar
2 Respuestas
+ 2
option 1. have a list of words, test if one of them appear twice or more in the text. option 2. go from left to right. a word is at least 2 chars, so cut 2 chars [0:1] and test if you find them again in the string, then [1,2]... and so on, until [len-2:len-1]. then with 3 chars and so on.
16th Jan 2018, 12:15 AM
Amir Galanty
Amir Galanty - avatar
+ 2
I saw below a challenge where you have to find a triplicated word. If you search it you can maybe find what you are searching. Edit: https://www.sololearn.com/discuss/1006164/?ref=app
16th Jan 2018, 12:17 AM
Sebastián Zapata
Sebastián Zapata - avatar