Visualized Explain 🚀 One line || Sorting || Easy solution
Approach\n Describe your approach to solving the problem. \nWe need to sort the original seats and students and calculate the difference between each student an
# Approach\n<!-- Describe your approach to solving the problem. -->\nWe need to sort the original `seats` and `students` and calculate the difference between each student and seat in the same position `i`\n\nConsider the test case bellow may help you understand the problem better:\n![image.png](https://assets.leetcode.com/users/images/37542fd6-d6d3-4ee9-a2cc-c15235b77ff6_1718248414.2105713.png)\n\n\n\n\n# Complexity\n- Time complexity: O(n*log(n))\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n*log(n))\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def minMovesToSeat(self, seats: List[int], students: List[int]) -> int:\n        return sum([abs(sorted(seats)[i] - sorted(students)[i]) for i in range(len(seats))])\n\n\n```
['Sorting', 'Python3']