You are viewing a single comment's thread. Return to all comments →
No need to make this more complicated than it should be
def noPrefix(words): dic = {} for i in range(len(words)): start = dic for j in range(len(words[i])): if words[i][j] not in start: start[words[i][j]] = {} start = start[words[i][j]] if '*' in list(start.keys()) or (j == len(words[i]) - 1 and (start)): print("BAD SET\n", words[i], sep = '') return start['*'] = True print('GOOD SET')
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 →
No need to make this more complicated than it should be