Problem 1130. Challenging perms function!

This problem is highly related with Problem 1127.

In oder to encrypt the word 'go' using phone keyboard, we need to do these;

- first find the digits that includes the letters in word. For example letter 'g' takes place on key 4. Letter 'o' is on key 6. So first number is 46.

- create all string permutations using the letters on keys (4 and 6). There are 'ghi' letters on key 4 and 'mno' letters on key 6. All two letter permutation list is {'gm';'gn';'go';'hm';'hn';'ho';'im';'in';'io'}. In this list third one is 'go'. So second number must be 3.

If input is 'go'; output must be [46 3].

What about 'hydroglycerin'? it is 1679616 th word on the permutation list constructed using keys 4937645923746.

If input is 'hydroglycerin'; output must be [4937645923746 1679616].

Given a string, return the keys on phone-keyboard and the order of this string in permutation list!

Solution Stats

70.0% Correct | 30.0% Incorrect
Last solution submitted on Oct 19, 2018

Problem Comments