No Prefix Set

  • + 0 comments

    I managed to have a solution passing tests other than dictionary tree. Sort the words. For each word check with words greater than it and break when not a prefix. Among the pair, the one with greater index in the unsorted original array is the one triggering the "BAD SET". However we need to iterate to the end and keep the first.