We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. Prepare
  2. Java
  3. Data Structures
  4. Java Arraylist
  5. Discussions

Java Arraylist

Problem
Submissions
Leaderboard
Discussions
Editorial

Sort 657 Discussions, By:

recency

Please Login in order to post a comment

  • Emre_Karakaya
    2 weeks ago+ 0 comments
            Scanner in =new Scanner(System.in);
            int n=in.nextInt();
            ArrayList<ArrayList<Integer>> l = new ArrayList<>();
    
            for(int i=0;i<n;i++){
                ArrayList<Integer> temp = new ArrayList<>();
                int d=in.nextInt();
                for(int x=0;x<d;x++){
                    temp.add(in.nextInt());
                }
                l.add(temp);  
            }
            
            int q=in.nextInt();
            for(int i =0;i<q;i++){
                int a=in.nextInt();
                int b=in.nextInt();
                try{
                     System.out.println(l.get(a-1).get(b-1));
                }catch(Exception e){
                     System.out.println("ERROR!");
                }
       
            }
            in.close();
    
    0|
    Permalink
  • KRITIKSAURAV33
    2 weeks ago+ 0 comments

    Here are the solution of Java Arraylist Hacker Rank Solution

    0|
    Permalink
  • alqys281_fare
    3 weeks ago+ 0 comments

    public static void main(String[] args) { Scanner sc =new Scanner( System.in) ; int lines =sc.nextInt() ; ArrayList array_list = new ArrayList() ; for (int i=0 ;i < lines;i++ ){ int colLineItem = sc.nextInt(); array_list.add(new ArrayList<>()); for(int y =0 ;y

                        } catch (Exception e) {
                            System.out.println("ERROR!");
                        }
                    }
    
    }
    

    }

    0|
    Permalink
  • alqys281_fare
    3 weeks ago+ 0 comments

    public static void main(String[] args) { Scanner sc =new Scanner( System.in) ; int lines =sc.nextInt() ; ArrayList array_list = new ArrayList() ; for (int i=0 ;i < lines;i++ ){ int colLineItem = sc.nextInt(); array_list.add(new ArrayList<>()); for(int y =0 ;y

                        } catch (Exception e) {
                            System.out.println("ERROR!");
                        }
                    }
    
    }
    

    }

    0|
    Permalink
  • bhuvaneswarand15
    3 weeks ago+ 0 comments

    import java.io.; import java.util.;

    public class Solution {

    public static void main(String[] args) {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
        List<List<Integer>> listOfArray = new ArrayList<>();
        Scanner s= new Scanner(System.in);
        int n =s.nextInt();
        for(int i=0;i<n;i++){
            int d=s.nextInt();
            List<Integer> listf = new ArrayList<Integer>() ;
            for(int j=0;j<d;j++){
            listf.add(s.nextInt());
            }
            listOfArray.add(listf);
        }
       // System.out.println(listOfArray);
       int q =s.nextInt();
       for(int i=0;i<q;i++){
         int x= s.nextInt();
         int y =s.nextInt();
         try{
        System.out.println( listOfArray.get(x-1).get(y-1));
         }
         catch(Exception ex){
             System.out.println("ERROR!");
         }
       }
            s.close();
    
    
    }
    

    }

    0|
    Permalink
Load more conversations

Need Help?


View editorial
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy