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
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 3ms, memory 12.6MB, accepted 2025-12-24.
class Solution(object):
def minMovesToSeat(self, seats, students):
seats.sort()
students.sort()
return sum(abs(s - t) for s, t in zip(seats, students))