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