Algorithm · Upstart · Medium
Given an array vocab of lowercase dictionary words and a sentence s whose space-separated words have been scrambled, recover the original sentence. A scrambled word is obtained by permuting only the internal letters, leaving the first and last characters in place. Therefore, a scrambled token and its original dictionary word must have the same length, the same first character, the same last character, and the same multiset of letters. Some vocab entries may be anagrams of…
Checking your access…