2037 - Minimum Number of Moves to Seat Everyone - Easy
Table of contents
Problem
Long story short:
- You are given two arrays of integers
seats
andstudents
. - Each has $n$ elements.
- We want to match the elements of
students
to the elements ofseats
(order doesn’t matter). - On each move we can increment or decrement one element of
students
by 1. - Return the minimum number of moves to match the elements.
seats
may contain duplicates.