c++ | Backtraking Without DP and BitMasking 94% Faster
\nclass Solution {\npublic:\n    int minSize = INT_MAX;\n    void minHelper(vector<int> tasks,int time,int index,vector<int> assign){\n        if(assign.size()>
```\nclass Solution {\npublic:\n    int minSize = INT_MAX;\n    void minHelper(vector<int> tasks,int time,int index,vector<int> assign){\n        if(assign.size()>=minSize)return;\n        \n        if(index==tasks.size()){\n            int size = assign.size();\n            minSize = size<minSize?size:minSize;\n            return;\n        }\n        \n        assign.push_back(tasks[index]);\n        minHelper(tasks,time,index+1,assign);\n        assign.pop_back();\n        \n        for(int i=0;i<assign.size();i++){\n            int task = tasks[index];\n            if(assign[i]+task<=time){\n                assign[i]+=task;\n                minHelper(tasks,time,index+1,assign);\n                assign[i]-=task;\n            }\n        }\n        \n    }\n    int minSessions(vector<int>& tasks, int sessionTime) {\n        sort(tasks.begin(),tasks.end(),greater<int>());\n        vector<int> assign;\n        minHelper(tasks,sessionTime,0,assign);\n        return minSize;\n    }\n};\n```
['Backtracking', 'Recursion']