SarthakKeshari / Java-Questions-and-Solutions

This repository aims to solve and create new problems from different spheres of coding. A path to help students to get access to solutions and discuss their doubts.
MIT License
47 stars 98 forks source link

Letter_combination_of_a_phone_number.java #330

Closed Raghavarora27 closed 3 years ago

Raghavarora27 commented 3 years ago

Issue Id you have worked upon -

Issue #329

Briefly explain your program logic -

 ""                   [ "" ]   
  |                    
 3 , 3                [d,e,f]
  |
23 , 2               a[d,e,f] + b[d,e,f] + c[d,e,f] -- > [ad,ae,af,bd,be,bf,cd,ce,cf]

Here, "23" is the input string , we will take out 2 and pass the remaining string i,e "3", then we will take out 3 and pass remaining string i,e, "" . (Then this will hit the base case and will return the ArrayList containing empty string) ( As Shown Above) Now, it will make combinations of characters of 3 with returned Arraylist and so no. (As done in code).

Screenshots(Attach 2 screenshots of your own input and output) -

Attach here

image image image


Checklist:

All the conditions should be fulfilled for considering your code for merging -

Raghavarora27 commented 3 years ago

I have to add the explanation in the code as well ??

Raghavarora27 commented 3 years ago

Now, Is it fine ?