MCPcopy Create free account
hub / github.com/Tiwarishashwat/InterviewCodes / Solution

Class Solution

SentenceToNumberPadSequence.java:1–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1class Solution
2{
3 String printSequence(String sentence)
4 {
5 // code here
6 String output="";
7
8 String arr[] = {"2","22","222", "3","33","333","4","44","444","5","55","555","6","66","666", "7","77","777","7777","8","88","888","9","99","999","9999"};
9
10 for(int i=0;i<sentence.length();i++)
11 {
12 if(sentence.charAt(i)==' ') output+="0";
13 else output+=arr[sentence.charAt(i)-'A'];
14 }
15 return output;
16 }
17}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected