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.
Tried using .sort() which could have been an effective O(n) solution as you only have to compare neighbouring words. Unfortunately this violates the "tested first" condition due to the reordering of words:
No Prefix Set
You are viewing a single comment's thread. Return to all comments →
Tried using
.sort()
which could have been an effectiveO(n)
solution as you only have to compare neighbouring words. Unfortunately this violates the "tested first" condition due to the reordering of words: