Skip to content

Commit f6748f1

Browse files
committed
Fixed Idea warnings
1 parent a1b4b4d commit f6748f1

File tree

7 files changed

+13
-15
lines changed
  • src/main/kotlin
    • g0701_0800/s0770_basic_calculator_iv
    • g1801_1900/s1825_finding_mk_average
    • g2901_3000/s2973_find_number_of_coins_to_place_in_tree_nodes
    • g3101_3200/s3130_find_all_possible_stable_binary_arrays_ii
    • g3401_3500

7 files changed

+13
-15
lines changed

src/main/kotlin/g0701_0800/s0770_basic_calculator_iv/Solution.kt

+6-6
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Solution {
4848
return ans
4949
}
5050

51-
fun evaluate(vars: Map<String?, Int>): Node {
51+
fun evaluate(vars: Map<String, Int>): Node {
5252
val ans = Node()
5353
for (cur in mem.keys) {
5454
var cnt = mem[cur]!!
@@ -137,14 +137,14 @@ class Solution {
137137
return a.sub(b)
138138
}
139139

140-
fun basicCalculatorIV(expression: String?, evalvarS: Array<String?>?, evalintS: IntArray?): List<String> {
140+
fun basicCalculatorIV(expression: String, evaluators: Array<String>, evalintS: IntArray): List<String> {
141141
val ans: List<String> = ArrayList()
142-
if (expression.isNullOrEmpty() || evalvarS == null || evalintS == null) {
142+
if (expression.isEmpty()) {
143143
return ans
144144
}
145-
val vars: MutableMap<String?, Int> = HashMap()
146-
for (i in evalvarS.indices) {
147-
vars[evalvarS[i]] = evalintS[i]
145+
val vars: MutableMap<String, Int> = HashMap()
146+
for (i in evaluators.indices) {
147+
vars[evaluators[i]] = evalintS[i]
148148
}
149149
val n = expression.length
150150
val numS = ArrayDeque<Node>()

src/main/kotlin/g1801_1900/s1825_finding_mk_average/MKAverage.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ class MKAverage(private val capacity: Int, private val boundary: Int) {
3636
val count = nums[num]
3737
if (skipCount < 0) {
3838
sum += num * min(count, numsCount)
39-
numsCount = (numsCount - min(count, numsCount)).toInt()
39+
numsCount = numsCount - min(count, numsCount)
4040
} else {
4141
skipCount -= count
4242
if (skipCount < 0) {
4343
sum += num * min(abs(skipCount), numsCount)
44-
numsCount = (numsCount - min(abs(skipCount), numsCount)).toInt()
44+
numsCount = numsCount - min(abs(skipCount), numsCount)
4545
}
4646
}
4747
if (numsCount == 0) {

src/main/kotlin/g2901_3000/s2973_find_number_of_coins_to_place_in_tree_nodes/Solution.kt

-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ class Solution {
6767
val bb = if (pq2.isNotEmpty()) pq2.poll() else 0
6868
result[i] = max(0, (a.toLong() * b * c))
6969
result[i] = max(result[i], max(0, (a.toLong() * aa * bb)))
70-
.toLong()
7170
pq = PriorityQueue { x: Int, y: Int -> y - x }
7271
pq.add(a)
7372
pq.add(b)

src/main/kotlin/g3101_3200/s3130_find_all_possible_stable_binary_arrays_ii/Solution.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ class Solution {
2424
}
2525
var ans: Long = 0
2626
val s = LongArray(one + 1)
27-
val n = (min(zero, one) + 1).toInt()
27+
val n = min(zero, one) + 1
2828
for (
2929
groups0 in (zero + limit - 1) / limit..min(zero, n)
30-
.toInt()
3130
) {
3231
val s0 = calc(groups0, zero, limit)
3332
for (

src/main/kotlin/g3401_3500/s3429_paint_house_iv/Solution.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Solution {
3434
}
3535
var ans = Long.Companion.MAX_VALUE
3636
for (x in longArrayOf(dp0, dp1, dp2, dp3, dp4, dp5)) {
37-
ans = min(ans, x).toLong()
37+
ans = min(ans, x)
3838
}
3939
return ans
4040
}

src/main/kotlin/g3401_3500/s3468_find_the_number_of_copy_arrays/Solution.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Solution {
1414
val diff = original[i] - original[i - 1]
1515
low = max((low + diff), bounds[i][0])
1616
high = min((high + diff), bounds[i][1])
17-
ans = min(ans, (high - low + 1)).toInt()
17+
ans = min(ans, high - low + 1)
1818
}
1919
return max(ans, 0)
2020
}

src/main/kotlin/g3401_3500/s3480_maximize_subarrays_after_removing_one_conflicting_pair/Solution.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Solution {
3232
f[n + 1] = n + 1
3333
f[n] = h[n]
3434
for (i in n - 1 downTo 1) {
35-
f[i] = min(h[i], f[i + 1]).toInt()
35+
f[i] = min(h[i], f[i + 1])
3636
}
3737
// forbiddenCount(x) returns (n - x + 1) if x <= n, else 0.
3838
// This is the number of forbidden subarrays starting at some i when f[i] = x.
@@ -53,7 +53,7 @@ class Solution {
5353
continue
5454
}
5555
// Simulate removal: new candidate at j becomes d2[j]
56-
val newCandidate = if (j < n) min(d2[j], f[j + 1]).toInt() else d2[j]
56+
val newCandidate = if (j < n) min(d2[j], f[j + 1]) else d2[j]
5757
// We'll recompute the new f values for indices 1..j.
5858
// Let newF[i] denote the updated value.
5959
// For i > j, newF[i] remains as original f[i].

0 commit comments

Comments
 (0)