top of page

Edabit Java: Maximum Possible Total, Easy Difficulty



Solving this question in Edabit:https://edabit.com/challenge/TM5f33Mpu52m2jcat using Arrays.sort method


Question:


Answer:



import java.util.Arrays;


public class Challenge {

public static int maxTotal(int[] nums) {

int total = 0;

Arrays.sort(nums);

for(int i = 5; i < nums.length; i++) {

total += nums[i];

}

return total;

}

}


0 views0 comments
Post: Blog2_Post
bottom of page