We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5d140b8 commit 71393d1Copy full SHA for 71393d1
src/main/java/g0401_0500/s0480_sliding_window_median/Solution.java
@@ -2,7 +2,6 @@
2
3
// #Hard #Array #Hash_Table #Heap_Priority_Queue #Sliding_Window
4
5
-import java.util.Arrays;
6
import java.util.Comparator;
7
import java.util.TreeSet;
8
@@ -14,7 +13,10 @@ public double[] medianSlidingWindow(int[] nums, int k) {
14
13
int len = nums.length;
15
double[] result = new double[len - k + 1];
16
if (k == 1) {
17
- return Arrays.copyOf(nums, nums.length);
+ for (int i = 0; i < len; i++) {
+ result[i] = nums[i];
18
+ }
19
+ return result;
20
}
21
Comparator<Integer> comparator =
22
(a, b) ->
0 commit comments