100% beats
\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n# Code\n\nclass Solution {\n    static int abs(int a){\n        return (a<0)?(-1*a):a
\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution {\n    static int abs(int a){\n        return (a<0)?(-1*a):a;\n    }\n    public int minMovesToSeat(int[] seats, int[] students) {\n        Arrays.sort(seats);\n        Arrays.sort(students);\n        int count=0,len=seats.length;\n        for(int i=0;i<len;i++){\n              count+=abs(seats[i]-students[i]);\n        }\n        return count;\n    }\n}\n```
['Java']