Gaming Array 1

  • + 0 comments

    Java, all test cases

     public static String gamingArray(List<Integer> arr) {
        int count = 0;
            int bigger = 0;
            
            for(Integer i : arr){
                if(i > bigger){
                    bigger = i;
                    count++;
                }    
            }
    
            if (count % 2 == 0) {
                return "ANDY";
            }
    
            return "BOB";
    }
    }