LeetCode solutions

2148. Minimum Number of Moves to Seat Everyone

My accepted Python solution to LeetCode problem 2148, Minimum Number of Moves to Seat Everyone, running in 3ms.

  • Difficulty: Easy
  • Python
  • Runtime 3ms
  • Memory 12.6MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 3ms, memory 12.6MB, accepted 2025-12-24.

python
class Solution(object):
    def minMovesToSeat(self, seats, students):
        seats.sort()
        students.sort()
        return sum(abs(s - t) for s, t in zip(seats, students))

Source