sorting by greedy approach💯
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n1. initialize a variable name as move to 0 for result.\n2. Sort both the 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n1. initialize a variable name as move to 0 for result.\n2. Sort both the giiven array.\n3. check for each index in seats array:\n     .Add absolute difference between index of seats and the\n      indices of the students.\n4. return the move value. \n\n# Complexity\n- Time complexity:\nO(nlogn)\n- Space complexity:\nO(n)\n\n# Code\n```\nclass Solution {\npublic:\n    int minMovesToSeat(vector<int>& seats, vector<int>& students) {\n        int move=0;\n     sort(students.begin(),students.end());\n     sort(seats.begin(),seats.end()); \n    \n     for(int i=0;i<seats.size();i++){\n        move+=abs(seats[i]-students[i]);\n     }\n     return move;\n    }\n};\n```
['Array', 'Greedy', 'Sorting', 'C++']