|
|
back to boardEach number maps to several letters of the alphabet. However, notice that several letters map to a single digit. If you can't go to the mountain, bring the mountain to you. Convert the words found in the dictionary for each case into digits, using the given map. Looking up which digit a letter maps to can be done in constant time if you use the right data structure. Then all that is left is to compare against the phone number given. Each number maps to several letters of the alphabet. However, notice that several letters map to a single digit. If you can't go to the mountain, bring the mountain to you. Convert the words found in the dictionary for each case into digits, using the given map. Looking up which digit a letter maps to can be done in constant time if you use the right data structure. Then all that is left is to compare against the phone number given. Can't believe!!!! Excellent idea!!!! If you can't go to the mountain, bring the mountain to you....wow what a statement! nice, but you must check such events: 1) word contains "ij" -> "11"(simple going letter by letter algorythm), that is not right it must transform into "1"( in dict "1":"ij"), but if word contains "ii" it must transform into "11". 2) if one word ends on some digit and another starts on it. we have words with "18" code and "89" code. Number "189". It depends, what letters words contain. There three alternatives: take both words, take with "18" or with "89". |
|
|