0
Leetcode Problem 908. Smallest Range I
908. Smallest Range I
AI Mock Interview
Leetcode Solutions
Minimize Score by Adjusting Elements within Range
Solution Idea
Algorithm Steps
Code Implementation
Complexity Analysis
Find the maximum value in the array,
maxVal
.
Find the minimum value in the array,
minVal
.
Calculate the current score as
maxVal - minVal
.
If the score is less than or equal to
2 * k
, return 0, as we can make all elements equal.
Otherwise, return the score reduced by
2 * k
, which is
maxVal - minVal - 2 * k
.
Ask Question
Programming Language
Purpose:
General Question
Debug My Code
image/screenshot of info
(optional)
[+]
Full Screen
Loading...
Get Answer
Suggested Answer
Answer
Full Screen
Copy Answer Code
Loading...