Minimum Number of Moves to Seat Everyone
You are given two integer arrays, seats and students, both of length n, where seats[i] is the position of the ith seat and students[i] is the position of the ith student in the row.
You are also given the following two rules:
Students can move only forward. Students can sit in any seat as long as it is not occupied. Return the minimum number of moves to seat all the students. A move is defined as one student moving one seat forward.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)