Skip to content

Commit 028e427

Browse files
refactor 480
1 parent 162fa20 commit 028e427

File tree

1 file changed

+0
-31
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-31
lines changed

Diff for: src/main/java/com/fishercoder/solutions/_480.java

-31
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,6 @@
33
import java.util.Collections;
44
import java.util.PriorityQueue;
55

6-
/**
7-
* 480. Sliding Window Median
8-
*
9-
* Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value.
10-
11-
Examples:
12-
[2,3,4] , the median is 3
13-
14-
[2,3], the median is (2 + 3) / 2 = 2.5
15-
16-
Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right.
17-
You can only see the k numbers in the window. Each time the sliding window moves right by one position.
18-
Your job is to output the median array for each window in the original array.
19-
20-
For example,
21-
Given nums = [1,3,-1,-3,5,3,6,7], and k = 3.
22-
23-
Window position Median
24-
--------------- -----
25-
[1 3 -1] -3 5 3 6 7 1
26-
1 [3 -1 -3] 5 3 6 7 -1
27-
1 3 [-1 -3 5] 3 6 7 -1
28-
1 3 -1 [-3 5 3] 6 7 3
29-
1 3 -1 -3 [5 3 6] 7 5
30-
1 3 -1 -3 5 [3 6 7] 6
31-
32-
Therefore, return the median sliding window as [1,-1,-1,3,5,6].
33-
34-
Note:
35-
You may assume k is always valid, ie: 1 ≤ k ≤ input array's size for non-empty array.
36-
*/
376
public class _480 {
387
public static class Solution1 {
398

0 commit comments

Comments
 (0)