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.
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";
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Gaming Array
You are viewing a single comment's thread. Return to all comments →