Python3, Greedy + DP
Finish large tasks first ==> Sort tasks reversely\n2. Use DP to put as many tasks as possible into one session\n3. Log the DP path such that those tasks done in
1. Finish large tasks first ==> Sort tasks reversely\n2. Use DP to put as many tasks as possible into one session\n3. Log the DP path such that those tasks done in the current session can be removed before starting the next session\n\n```\nclass Solution:\n    def minSessions(self, tasks: List[int], sessionTime: int) -> int:\n        # dp[ntasks+1][sesstionTime+1]\n\t\t# Put large tasks first\n        tasks.sort(reverse=True)\n        \n        tasks_ = [tasks[i] for i in range(len(tasks))]\n        nSession = 0\n        while len(tasks_) > 0:\n            # Put as many task as possible into one session\n            dp = [[0] * (sessionTime+1) for _ in range(len(tasks_)+1)]\n            path = [[False] * (sessionTime+1) for _ in range(len(tasks_)+1)]\n            \n            delete = [False] * len(tasks_)\n            nNew = len(tasks_)\n            \n            for i in range(1,len(tasks_)+1):\n                for j in range(1,sessionTime+1):\n                    dp[i][j] = dp[i-1][j]\n                    if (j-tasks_[i-1] >= 0):\n                        # Put in tasks[i-1]\n                        if dp[i][j] < dp[i-1][j-tasks_[i-1]] + tasks_[i-1]:\n                            dp[i][j] = dp[i-1][j-tasks_[i-1]] + tasks_[i-1]\n                            path[i][j] = True\n                            nNew -= 1\n\n\t\t\t# Remove those tasks in the current session            \n            k = sessionTime;\n            for i in range(len(tasks_), 0, -1):\n                if path[i][k] and k >= 1:\n                    delete[i-1] = True\n                    k = k - tasks_[i-1]\n                        \n            newtasks_ = []\n            count = 0\n            for i in range(len(tasks_)):\n                if not delete[i]:\n                    newtasks_.append(tasks_[i])\n        \n            tasks_ = newtasks_\n            \n            nSession += 1\n            \n        return nSession\n```
['Python3']