public static void testNumber(int[] arr) { int max = arr[0]; int min = arr[0]; int avg = 0; int sum = 0; for (int i = 0; i < arr.length; i++) { if (arr[i] > max) { max = arr[i]; } if (arr[i] < min) { min = arr[i]; } sum += arr[i]; } avg = sum / a…
Easy303 Easy633 package easy; public class e303 { private int[] sums; public e303(int[] nums) { sums = new int[nums.length+1]; for (int i = 0; i < nums.length; i++) sums[i+1] = sums[i] + nums[i]; } public int sumRange(int i, int j) { return sums[j+1]…
题目描述: Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of the corresponding kind. You need to distribute these candies equally in number to brother and si…