JAVA_Smallest Range I_LeetCode 908


JAVA_Smallest Range I_LeetCode 908

JAVA_Smallest Range I_LeetCode 908 풀이 class Solution { public int smallestRangeI(int[] nums, int k) { int max=nums[0], min=nums[0]; for(int num :nums){ max = Math.max(max,num); min = Math.min(min,num); } min = (max - k) - (min + k); return min < 0 ? 0 : min; } } * 출처 https://leetcode.com/problems/smallest-range-i/ Smallest Range I - LeetCode Can you solve this real interview question? Smallest Range I - You are given an integer array nums and an integer k. In one operation, you can choose any in...


#JAVA #JAVA_LeetCode908 #JAVA_SmallestRangeI #JAVA_SmallestRangeI_LeetCode908 #SmallestRangeI_LeetCode908

원문링크 : JAVA_Smallest Range I_LeetCode 908