File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
src/main/kotlin/g3301_3400
s3318_find_x_sum_of_all_k_long_subarrays_i
s3321_find_x_sum_of_all_k_long_subarrays_ii Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ class Solution {
4040 }
4141 var count = x
4242 var sum = 0
43- while (! pq.isEmpty () && count > 0 ) {
43+ while (pq.isNotEmpty () && count > 0 ) {
4444 val pair = pq.remove()
4545 sum + = pair.num * pair.freq
4646 count--
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ class Solution {
5656 ans[i - k + 1 ] = if (s1.size == x) xSum else sum
5757 val v = nums[i - k + 1 ]
5858 sum - = v.toLong()
59- curCnt = cnt.get(v) !!
59+ curCnt = cnt[v] !!
6060 if (curCnt > 1 ) {
6161 cnt.put(v, curCnt - 1 )
6262 } else {
@@ -74,7 +74,7 @@ class Solution {
7474 if (curCnt > 1 ) {
7575 s2.add(RC (v, curCnt - 1 ))
7676 }
77- while (s1.size < x && ! s2.isEmpty ()) {
77+ while (s1.size < x && s2.isNotEmpty ()) {
7878 val r = s2.last()
7979 s2.remove(r)
8080 s1.add(r)
You can’t perform that action at this time.
0 commit comments