Posts

Showing posts from December, 2022

3 Divisors Geeks For Geeks

Problem Link: https://practice.geeksforgeeks.org/problems/3-divisors3942/1 It is also the problem of the day for 8-12-2022 Solution: //{ Driver Code Starts //Initial Template for Java import java.io.*; import java. util.*; class GFG {     public static void main(String args[])throws IOException     {         Scanner sc = new Scanner(System.in);         int t = sc.nextInt();         while(t-->0){             int q = sc.nextInt();             ArrayList<Long> query = new ArrayList<>();             for(int i=0;i<q;i++){                 query.add(sc.nextLong());             }             Solution ob = new Solution();                              ArrayList<Integer> ans = ob.threeDivisors(query,q);             for(int cnt : ans) {                 System.out.println(cnt);             }         }     } } // } Driver Code Ends //User function Template for Java class Solution{     static ArrayList<Long>aa=new ArrayList<Long>();          //for checking prime