the calculations and explanation are not transparent
Unable to understand the logic of the questions
Relate this problem to your mobileβs keypad.
If you have to search the name/contact of any particular person, then you can directly search on the keypad as:
2 corresponds to letters a, b, c
3 corresponds to letters d, e, f
4 to g, h, i
so on⦠till 9
So, you have given a vector of names/ strings as specified in the question.
Now, the user will enter a string of digits.
Example : 34
34 will result into combinations :
dg eg fg
dh eh fh
di ei fi
Corresponding strings are output.
- vidhi contains dh
- divyam contains di
- sneha contains eh
Now this is the keypad array you have to use like this -
public static char[][] keypad = {{β β}, {β.β, β+β, β@β, β$β}, {βaβ, βbβ, βcβ}, {βdβ, βeβ, βfβ}, {βgβ, βhβ, βiβ}, {βjβ, βkβ, βlβ}, {βmβ, βnβ, βoβ}, {βpβ, βqβ, βrβ, βsβ}, {βtβ, βuβ, βvβ}, {βwβ, βxβ, βyβ, βzβ}};
if you have done smart keypad - 1 then it will be easy for you because just you have to search in the given array.