Skip to content

Commit

Permalink
prints all possible keypad codes/string (like in old keypad phones) f…
Browse files Browse the repository at this point in the history
…rom given numeric string
  • Loading branch information
NirmalSilwal committed Aug 11, 2020
1 parent 27f2716 commit 10c84bc
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion CodingBlocks Training/Day11/printKeypadCodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static void main(String[] args) {
}

public static void printAllKeypadCodes(String str, String result) {
if (str.equals("")) {
if (str.length() == 0){
System.out.println(result);
return;
}
Expand Down Expand Up @@ -59,3 +59,34 @@ public static String getCode(char firstChar) {
return "";
}
}

/*
*output:
adg
adh
adi
aeg
aeh
aei
afg
afh
afi
bdg
bdh
bdi
beg
beh
bei
bfg
bfh
bfi
cdg
cdh
cdi
ceg
ceh
cei
cfg
cfh
cfi
*/

0 comments on commit 10c84bc

Please sign in to comment.