Clean Java
Use backtring and prune, we have a sessions buckets, we put each task into any one of "not full" one, we prefer to put into old buckets than into new empty buck
Use backtring and prune, we have a sessions buckets, we put each task into any one of "not full" one, we prefer to put into old buckets than into new empty buckets cause this would incrase speed.\n\n```\n//1ms Accept\nclass Solution {\n    int res;\n    int maxSessionTime;\n    int[] tasks;\n    int[] sessions;\n    public int minSessions(int[] tasks, int sessionTime) {\n\t    Arrays.sort(tasks);\n        this.res = tasks.length;\n        this.maxSessionTime = sessionTime;\n        this.tasks = tasks;\n        this.sessions = new int[tasks.length];\n        dfs(tasks.length - 1, 0);\n        return res;\n    }\n    \n    private void dfs(int taskID, int sessionCount) {\n        if (sessionCount > res) return; //prune, if we didn\'t use prune, it will be 2200ms, if lucky you get ac\n        if (taskID == tasks.length) {\n            res = Math.min(res, sessionCount);\n            return;\n        }\n        for (int i = 0; i < sessionCount; i++)\n            if (sessions[i] + tasks[taskID] <= maxSessionTime) { //put task into old session bucket\n                sessions[i] += tasks[taskID];\n                dfs(taskID - 1, sessionCount);\n                sessions[i] -= tasks[taskID];\n            }\n        sessions[sessionCount] += tasks[taskID]; //put task into new empty session bucket\n        dfs(taskID - 1, sessionCount + 1);\n        sessions[sessionCount] -= tasks[taskID];\n    }\n}\n```
[]