We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a4d8e48 commit 8ad31b8Copy full SHA for 8ad31b8
minimum-number-of-moves-to-seat-everyone/index.kt
@@ -0,0 +1,11 @@
1
+package com.github.masx200.leetcode_test.minimum_number_of_moves_to_seat_everyone
2
+
3
+import kotlin.math.abs
4
5
+class Solution {
6
+ fun minMovesToSeat(seats: IntArray, students: IntArray): Int {
7
+ seats.sort()
8
+ students.sort()
9
+ return seats.mapIndexed { i, v -> abs(v - students[i]) }.sum()
10
+ }
11
+}
0 commit comments