Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
isaiahliu committed Dec 13, 2024
1 parent 53d7d41 commit ba8caa3
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/main/kotlin/p32xx/Problem3264.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package p32xx

import util.expect
import java.util.*

fun main() {
class Solution {
fun getFinalState(nums: IntArray, k: Int, multiplier: Int): IntArray {
val indices = PriorityQueue(compareBy<Int> { nums[it] }.thenBy { it })
indices.addAll(nums.indices)

repeat(k) {
val index = indices.poll()

nums[index] *= multiplier

indices.add(index)
}

return nums
}
}
expect {
Solution().getFinalState(
intArrayOf(), 1, 1
)
}
}

0 comments on commit ba8caa3

Please sign in to comment.