Simple C++ solution
\nclass Solution {\npublic:\n    int ans=INT_MAX;\n    int minSessions(vector<int>& tasks, int sessions) {\n         vector<int> subs;\n         solve(0,tasks,s
```\nclass Solution {\npublic:\n    int ans=INT_MAX;\n    int minSessions(vector<int>& tasks, int sessions) {\n         vector<int> subs;\n         solve(0,tasks,subs,sessions);\n         return ans;\n    }\n    void solve(int pos,vector<int> &tasks,vector<int>&subs,int sessions) {\n           if(pos>=tasks.size()) {\n                 ans=min(ans,(int)subs.size());\n                 return; \n           }\n           if(subs.size()>ans) return;\n           for(int set=0; set<subs.size(); set++) {\n                  if(subs[set]+tasks[pos]<=sessions) {\n                       subs[set]+=tasks[pos];\n                       solve(pos+1,tasks,subs,sessions);\n                       subs[set]-=tasks[pos];\n                  }\n           }\n           subs.push_back(tasks[pos]);\n           solve(pos+1,tasks,subs,sessions);\n           subs.pop_back();\n    }\n};\n```
['Backtracking']