![]() |
VOOZH | about |
Given a sentence in the form of a string, convert it into its equivalent mobile numeric keypad sequence.
Examples :
Input: GEEKSFORGEEKS
Output: 4333355777733366677743333557777
Explanation: For obtaining a number, we need to press a number corresponding to that character for a number of times equal to the position of the character. For example, for character E, press number 3 two times and accordingly.Input : HELLO WORLD
Output : 4433555555666096667775553
Approach: Follow the steps given below to convert a sentence into its equivalent mobile numeric keypad sequence.
Below is the implementation of above method :
4333355777733366677743333557777
Time complexity: O(N), For traversing the string
Auxiliary Space: O(1)