Skip to content

Commit 35ee9a5

Browse files
committed
Fixed sonar
1 parent 3702124 commit 35ee9a5

File tree

1 file changed

+3
-5
lines changed
  • src/main/kotlin/g3601_3700/s3636_threshold_majority_queries

1 file changed

+3
-5
lines changed

src/main/kotlin/g3601_3700/s3636_threshold_majority_queries/Solution.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ internal class Solution {
1616
}
1717
}
1818

19-
// A helper class to store a query's range and its original index.
2019
private class Query(var l: Int, var r: Int, var originalIndex: Int)
2120

2221
private lateinit var nums: IntArray
@@ -70,13 +69,12 @@ internal class Solution {
7069
if (blockA != blockB) {
7170
return@sortWith blockA.compareTo(blockB)
7271
}
73-
if ((blockA % 2) == 1) {
74-
return@sortWith b.r.compareTo(a.r)
72+
return@sortWith if ((blockA % 2) == 1) {
73+
b.r.compareTo(a.r)
7574
} else {
76-
return@sortWith a.r.compareTo(b.r)
75+
a.r.compareTo(b.r)
7776
}
7877
}
79-
8078
val ans = IntArray(qLen)
8179
var currentL = 0
8280
var currentR = -1

0 commit comments

Comments
 (0)