Simple C++ solution | Greedy | Sorting
Code\n\nclass Solution {\npublic:\n    int minMovesToSeat(vector<int>& seats, vector<int>& students) {\n        const int m = seats.size();\n        int ans = 0
# Code\n```\nclass Solution {\npublic:\n    int minMovesToSeat(vector<int>& seats, vector<int>& students) {\n        const int m = seats.size();\n        int ans = 0;\n        sort(seats.begin(),seats.end());\n        sort(students.begin(),students.end());\n        for(int i=0;i<m;++i){ans+=abs(seats[i]-students[i]);}\n        return ans;\n    }\n};\n```\n\nPlease upvote if you found it useful!
['Greedy', 'Sorting', 'C++']