C++ Simple and Clean Solution
Idea:\nWe sort both arrays.\nThen, greedily, we loop through them and match each student with the closest seat.\n\nTime Complexity: O(nlogn)\nSpace Complexity: 
**Idea:**\nWe sort both arrays.\nThen, greedily, we loop through them and match each student with the closest seat.\n\n**Time Complexity:** O(nlogn)\n**Space Complexity:** O(1)\n```\nclass Solution {\npublic:\n    int minMovesToSeat(vector<int>& seats, vector<int>& students) {\n        sort(seats.begin(), seats.end());\n        sort(students.begin(), students.end());\n        \n        int res = 0;\n        for (int i = 0; i < seats.size(); i++) res += abs(seats[i] - students[i]);\n        \n        return res;\n    }\n};\n```\n**Like it? please upvote!**
['C']