File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 245
245
| 896 | [ Monotonic Array] ( https://leetcode.com/problems/monotonic-array ) | [ ![ Java] ( assets/java.png )] ( src/MonotonicArray.java ) |
246
246
| 897 | [ Increasing Order Search Tree] ( https://leetcode.com/problems/increasing-order-search-tree ) | [ ![ Java] ( assets/java.png )] ( src/IncreasingOrderSearchTree.java ) |
247
247
| 905 | [ Sort Array by Parity] ( https://leetcode.com/problems/sort-array-by-parity ) | |
248
- | 908 | [ Smallest Range I] ( https://leetcode.com/problems/smallest-range-i ) | |
248
+ | 908 | [ Smallest Range I] ( https://leetcode.com/problems/smallest-range-i ) | [ ![ Java ] ( assets/java.png )] ( src/SmallestRangeI.java ) |
249
249
| 914 | [ X of a kind in a Deck of Cards] ( https://leetcode.com/problems/x-of-a-kind-in-a-deck-of-cards ) | |
250
250
| 917 | [ Reverse Only Letters] ( https://leetcode.com/problems/reverse-only-letters ) | |
251
251
| 922 | [ Sort Array by Parity II] ( https://leetcode.com/problems/sort-array-by-parity-ii ) | |
Original file line number Diff line number Diff line change
1
+ import java .util .Arrays ;
2
+
3
+ public class SmallestRangeI {
4
+ public int smallestRangeI (int [] nums , int k ) {
5
+ return Math .max (
6
+ 0 ,
7
+ Arrays .stream (nums ).max ().getAsInt () - Arrays .stream (nums ).min ().getAsInt () - 2 * k
8
+ );
9
+ }
10
+ }
You can’t perform that action at this time.
0 commit comments