Skip to content

Commit adf4ce0

Browse files
committed
Improved task
1 parent 03fcf17 commit adf4ce0

File tree

1 file changed

+5
-7
lines changed
  • src/main/kotlin/g3501_3600/s3587_minimum_adjacent_swaps_to_alternate_parity

1 file changed

+5
-7
lines changed

src/main/kotlin/g3501_3600/s3587_minimum_adjacent_swaps_to_alternate_parity/Solution.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@ class Solution {
3131
return ans
3232
}
3333

34-
companion object {
35-
private fun helper(indices: MutableList<Int>): Int {
36-
var swaps = 0
37-
for (i in indices.indices) {
38-
swaps += abs(indices[i] - 2 * i)
39-
}
40-
return swaps
34+
private fun helper(indices: MutableList<Int>): Int {
35+
var swaps = 0
36+
for (i in indices.indices) {
37+
swaps += abs(indices[i] - 2 * i)
4138
}
39+
return swaps
4240
}
4341
}

0 commit comments

Comments
 (0)