Create a key map (not FAANG) - I can't solve
Anonymous User
512

Given a list of strings return true|false if a mapping can be created from char to string where the char can only be from that string.

Input: ["abc", "bcd", "efg"]
Map: { "a" -> "abc", "b" -> "bcd", "e" -> "efg" }
Output: true

Other test inputs:
["ba", "za", "zza"] -> true, because { b -> ab, z -> za, a -> zza }
["fa", "ac", "fc"] -> true, because { f -> fa, a -> ca, c -> fc }
["fa", "af", "aff"] -> false

I'm having a hard time solving it.

Comments (4)