import java.util.Arrays; interface HighLow { static int[] findLargestAndSmallest(int[] nums) { if(nums == null || nums.length == 0){ return null; } Arrays.sort(nums); return new int[]{nums[0],nums[nums.length-1]}; } }
- import java.util.Arrays;
- interface HighLow {
- static int[] findLargestAndSmallest(int[] nums) {
// Change min and max below to be the highest and lowest values// in the nums array provided to the functionint min = 0;int max = 100;return new int[]{min, max};- if(nums == null || nums.length == 0){
- return null;
- }
- Arrays.sort(nums);
- return new int[]{nums[0],nums[nums.length-1]};
- }
- }