Google | Phone | Faulty Keyboard
Anonymous User
19531

This was the question:

There's a faulty keyboard which types a space whenever key 'e' is hit.

Location: US
Position: SWE at Google

Given a string which is the sentence typed using that keyboard and a dictionary of valid words, return all possible correct formation of the sentence.

Example:

Input: s = "I lik   to   xplor   univ rs ", dictionary  = {"like", "explore", "toe", "universe", "rse"}
Output:
["I like to explore universe",
"I like toe xplor  universe",
"I like to explore univ rse",
"I like toe xplor  univ rse"]

There are two spaces after "lik", "to" and before "univ" in the sentence indicating one is actual space and another one is resulted by hitting key 'e'.

Comments (37)