Skip to content

Commit a0a5d10

Browse files
authored
Improved tasks 55, 72, 295
1 parent bfee3d3 commit a0a5d10

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

src/main/scala/g0001_0100/s0055_jump_game/readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Return `true` _if you can reach the last index, or_ `false` _otherwise_.
3535
```scala
3636
object Solution {
3737
def canJump(nums: Array[Int]): Boolean = {
38-
var sz = nums.length
38+
val sz = nums.length
3939
// We set tmp to 1 so it won't break on the first iteration
4040
var tmp = 1
4141

src/main/scala/g0001_0100/s0072_edit_distance/readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ object Solution {
4646
return minDistance(w2, w1)
4747
}
4848

49-
var dp = Array.range(0, n2 + 1)
49+
val dp = Array.range(0, n2 + 1)
5050

5151
for (j <- 0 to n2) {
5252
dp(j) = j

src/main/scala/g0201_0300/s0295_find_median_from_data_stream/readme.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class MedianFinder() {
5454
private val maxHeap = mutable.PriorityQueue.empty[Int]
5555
private val minHeap = mutable.PriorityQueue.empty[Int](Ordering.Int.reverse)
5656

57-
def addNum(num: Int) {
57+
def addNum(num: Int): Unit = {
5858
maxHeap += num
5959
minHeap += maxHeap.dequeue()
6060

@@ -68,7 +68,6 @@ class MedianFinder() {
6868
else
6969
(maxHeap.head + minHeap.head).toDouble / 2
7070
}
71-
7271
}
7372

7473
/*

0 commit comments

Comments
 (0)