Python 3 || 15 lines, dp, bisect_left  || T/S: 97% / 52%
\npython3 []\nclass Solution:\n    def minSessions(self, tasks: List[int], sessionTime: int) -> int:\n\n        def canFinish(x: int)-> bool:\n\n            @lr
\n```python3 []\nclass Solution:\n    def minSessions(self, tasks: List[int], sessionTime: int) -> int:\n\n        def canFinish(x: int)-> bool:\n\n            @lru_cache(None)\n            def dp(idx: int, slots: tuple)-> bool:\n\n                if idx == n: return True\n                update, task = list(slots), tasks[idx]\n\n                for j, slot in enumerate(slots):\n                    if slot >= task:\n\n                        update[j]-= task\n                        if dp(idx + 1, tuple(sorted(update))): return True\n                        update[j]+= task\n\n                return False\n\n            return dp(0, tuple(sessionTime for _  in range(x)))\n\n\n        n = len(tasks)\n        tasks.sort(reverse=True)\n\n        return bisect_left(range(n), True, key = canFinish)\n```\n\n[https://leetcode.com/problems/minimum-number-of-work-sessions-to-finish-the-tasks/submissions/1371416312/?submissionId=1371412635](https://leetcode.com/problems/minimum-number-of-work-sessions-to-finish-the-tasks/submissions/1371416312/?submissionId=1371412635)\n\nI could be wrong, but I think that, worst case, time complexity is *O*(*N* 2^*N)*) and space complexity is *O*(*N* 2^*N)), in which *N* ~ `len(nums)`.
['Python3']