We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Dumb question dumb answer. Passes all tests though.
defnoPrefix(words):# Write your code herecontent={}subs={}forwordinwords:content[word]=content.get(word,0)+1foriinrange(len(word)-1):subs[word[:i+1]]=1ifwordinsubs:print('BADSET')print(word)returnforiinrange(len(word)):ifword[:i+1]incontent:ifi==len(word)-1:ifcontent[word]>1:print('BADSET')print(word)returnelse:print('BADSET')print(word)returnprint('GOODSET')
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
No Prefix Set
You are viewing a single comment's thread. Return to all comments →
Dumb question dumb answer. Passes all tests though.