File tree Expand file tree Collapse file tree 3 files changed +3
-4
lines changed
g0201_0300/s0295_find_median_from_data_stream Expand file tree Collapse file tree 3 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ package g0001_0100.s0055_jump_game
66
77object Solution {
88 def canJump (nums : Array [Int ]): Boolean = {
9- var sz = nums.length
9+ val sz = nums.length
1010 // We set tmp to 1 so it won't break on the first iteration
1111 var tmp = 1
1212
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ object Solution {
1414 return minDistance(w2, w1)
1515 }
1616
17- var dp = Array .range(0 , n2 + 1 )
17+ val dp = Array .range(0 , n2 + 1 )
1818
1919 for (j <- 0 to n2) {
2020 dp(j) = j
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class MedianFinder() {
1010 private val maxHeap = mutable.PriorityQueue .empty[Int ]
1111 private val minHeap = mutable.PriorityQueue .empty[Int ](Ordering .Int .reverse)
1212
13- def addNum (num : Int ) {
13+ def addNum (num : Int ): Unit = {
1414 maxHeap += num
1515 minHeap += maxHeap.dequeue()
1616
@@ -24,7 +24,6 @@ class MedianFinder() {
2424 else
2525 (maxHeap.head + minHeap.head).toDouble / 2
2626 }
27-
2827}
2928
3029/*
You can’t perform that action at this time.
0 commit comments