C++ || DP || Top Down
\nclass Solution {\npublic:\n    typedef long long int64;\n    int64 dp[1 << 15][16];\n    int threshold;\n    int64 solve(vector<int> &t, int mask, int currTim
```\nclass Solution {\npublic:\n    typedef long long int64;\n    int64 dp[1 << 15][16];\n    int threshold;\n    int64 solve(vector<int> &t, int mask, int currTime) {\n        int n = t.size();\n        if(mask == ((1 << n) - 1)) {\n            return 1;\n        }\n        if(dp[mask][currTime] != -1) {\n            return dp[mask][currTime];\n        }\n        int64 ans = 1 << 20;\n        for(int i = 0; i < n; i++) {\n            if((mask & (1 << i)) != 0) {\n                continue;\n            }\n            // include in current session if possible\n            if(currTime + t[i] <= threshold) {\n                ans = min(ans, solve(t, mask | (1 << i), currTime + t[i]));\n            }\n            // use a new session\n            ans = min(ans, (1LL + solve(t, mask | (1 << i), t[i])));\n        }\n        return dp[mask][currTime] = ans;\n    }\n    \n    int minSessions(vector<int>& tasks, int sessionTime) {\n        memset(dp, -1, sizeof(dp));\n        threshold = sessionTime;\n        return solve(tasks, 0, 0);\n    }\n    \n};\n```
[]