Skip to content

Commit f5c1c3f

Browse files
committed
Fixed format
1 parent 9dcb8ac commit f5c1c3f

File tree

1 file changed

+6
-6
lines changed
  • src/main/kotlin/g3201_3300/s3283_maximum_number_of_moves_to_kill_all_pawns

1 file changed

+6
-6
lines changed

src/main/kotlin/g3201_3300/s3283_maximum_number_of_moves_to_kill_all_pawns/Solution.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package g3201_3300.s3283_maximum_number_of_moves_to_kill_all_pawns
22

33
// #Hard #Array #Math #Breadth_First_Search #Bit_Manipulation #Bitmask #Game_Theory
4-
// #2025_03_22_Time_119_ms_(100.00%)_Space_66.82_MB_(100.00%)
4+
// #2025_03_22_Time_147_ms_(100.00%)_Space_67.70_MB_(100.00%)
55

66
import kotlin.math.max
77
import kotlin.math.min
@@ -23,20 +23,20 @@ class Solution {
2323
var count = n - i
2424
val visited = Array<BooleanArray>(50) { BooleanArray(50) }
2525
visited[positions[i][0]][positions[i][1]] = true
26-
val que: java.util.Queue<IntArray> = java.util.ArrayDeque<IntArray>()
27-
que.offer(intArrayOf(positions[i][0], positions[i][1]))
26+
val que: ArrayDeque<IntArray> = ArrayDeque()
27+
que.add(intArrayOf(positions[i][0], positions[i][1]))
2828
var steps = 1
29-
while (!que.isEmpty() && count > 0) {
29+
while (que.isNotEmpty() && count > 0) {
3030
var size = que.size
3131
while (size-- > 0) {
32-
val cur = que.poll()
32+
val cur = que.removeFirst()
3333
val x = cur[0]
3434
val y = cur[1]
3535
for (d in DIRECTIONS) {
3636
val nx = x + d[0]
3737
val ny = y + d[1]
3838
if (0 <= nx && nx < 50 && 0 <= ny && ny < 50 && !visited[nx][ny]) {
39-
que.offer(intArrayOf(nx, ny))
39+
que.add(intArrayOf(nx, ny))
4040
visited[nx][ny] = true
4141
val j = pos[nx][ny]
4242
if (j > i) {

0 commit comments

Comments
 (0)