C++ backtracking + dp
\nclass Solution {\npublic:\n    \n    int minSes(int session,long long int completedTasks,vector<int>& tasks,int sessionTime,vector<vector<int>>& dp)\n    {\n 
```\nclass Solution {\npublic:\n    \n    int minSes(int session,long long int completedTasks,vector<int>& tasks,int sessionTime,vector<vector<int>>& dp)\n    {\n        int n = tasks.size();\n        \n        if(completedTasks==(pow(2,n)-1))\n        {\n            return dp[session][completedTasks]=1;\n        }\n        \n        if(dp[session][completedTasks]!=-1)\n            return dp[session][completedTasks];\n            \n        bool isAvail = false;\n        int minSessions = INT_MAX;\n        \n        for(int i=0;i<n;i++)\n        {\n            if((completedTasks&(1<<i))==0 && tasks[i]<=session)\n            {\n                isAvail = true;\n                minSessions = min(minSessions,minSes(session-tasks[i],completedTasks|(1<<i),tasks,sessionTime,dp));\n            }\n        }\n        \n        if(!isAvail)\n        {\n            return dp[session][completedTasks]=1+minSes(sessionTime,completedTasks,tasks,sessionTime,dp);\n        }\n        \n        return dp[session][completedTasks]=minSessions;\n    }\n    \n    int minSessions(vector<int>& tasks, int sessionTime)\n    {\n        long long int completedTasks = 0,n=tasks.size();\n        vector<vector<int>> dp(sessionTime+5,vector<int>((1<<(n+1))+3,-1));\n        \n        return minSes(sessionTime,completedTasks,tasks,sessionTime,dp);\n    }\n    \n};\n```
[]