For this Question: Aunt May receives a letter from Peter’s school that his grades are going down. So she decides to confiscate his phone. One day when Aunt May has gone shopping, Peter decides to get his phone back. He tries unlocking the phone but soon realizes that it is locked. So he puts on his detective cap and analyses the fingerprints of his Aunt on most keypads. He soon dials down the most used number. Help Peter make a list of all possible passwords using N digits.
Given a keypad as shown in diagram, and an N digit number. List all words which are possible by pressing these numbers.
By pressing a digit you can access any of its mentioned characters.The first line of input contains a single integer T denoting the number of test cases. The first line of each test case contains the number of digits N. The next line contains N space-separated integers depicting the digits.
 
Constraints:
1 <= T <= 100
1 <= N <= 9
2 <= D[i] <= 9Print all possible words in lexicographical order.Sample Input:
2
3
2 3 4
3
3 4 5

Sample 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
dgj dgk dgl dhj dhk dhl dij dik dil egj egk egl ehj ehk ehl eij eik eil fgj fgk fgl fhj fhk fhl fij fik fil

Explanation:
Testcase 1: When we press 2, 3, 4 then adg, adh, adi, ., cfi are the list of possible words.
Testcase 2: When we press 3, 4, 5 then dgj, dgk, dgl,. , fil are the list of possible words., I have written this Solution Code: import java.util.*;
import java.io.*;
import java.lang.*;

class Main
{
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        
        
        while(t-- > 0)
        {
            int n = sc.nextInt(); // input size of array
            int arr[] = new int[n]; //input the elements of array that are keys to be pressed
            
            for(int i = 0; i < n; i++)
               arr[i] = sc.nextInt();
             possibleWords(arr, n);
             System.out.println();
              
        }
    }

    static String hash[] = {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
    
    static void possibleWords(int arr[], int N)
    {
            String str = "";
            for(int i = 0; i < N; i++)
              str += arr[i];
        ArrayList<String> res = possibleWordsUtil(str);
              Collections.sort(res); // arrange all possible strings lexicographically
              for(String s: res)
                System.out.print(s + " ");
                    
    }
    static ArrayList<String> possibleWordsUtil(String str)
    {
        // If str is empty 
        if (str.length() == 0) { 
            ArrayList<String> baseRes = new ArrayList<>(); 
            baseRes.add(""); 
  
            // Return an Arraylist containing 
            // empty string 
            return baseRes; 
        } 
  
        // First character of str 
        char ch = str.charAt(0); 
        
  
        // Rest of the characters of str 
        String restStr = str.substring(1); 
  
        // get all the combination
        ArrayList<String> prevRes = possibleWordsUtil(restStr); 
        ArrayList<String> Res = new ArrayList<>(); 
      
        String code = hash[ch - '0']; 
  
        for (String val : prevRes) { 
  
            for (int i = 0; i < code.length(); i++) { 
                Res.add(code.charAt(i) + val); 
            } 
        } 
        return Res; 
    }

}, In this Programming Language: Java, Now tell me if this Code is compilable or not?