• + 0 comments
    public static String gamingArray(List<Integer> arr) {
    // Write your code here
    
        int count = 0, end = -1;
    
        for(int i = 0; i< arr.size(); i++){
    
                count++;
                end = arr.indexOf(Collections.max(arr));
                //System.out.println("MAX: "+ Collections.max(arr) +" Ind: "+end);
    
                for(int j = end; j< arr.size(); j++){
                    //System.out.println("J: "+j+" Remove: "+ arr.get(j));
                    arr.remove(j);
                    j--;
            }
    
            // for(Integer k:arr){
            //     System.out.println("Arr: "+k);
            // }
        }
    
    
                I dont know why all my test cases were not getting successful. Could any one help me with my solution and clearly explain how to work with constrains 
    
        if(count%2==0)    return "ANDY";
        else    return "BOB";
    
    }