c++ solution with explanation backtrack/dfs type.
As we are checking for all positions/arrangements of a task to be done hence it always give min answer. Any doubt ask in comment else if you like? upvote.\n\ncl
As we are checking for all positions/arrangements of a task to be done hence it always give min answer. Any doubt ask in comment else if you like? upvote.\n```\nclass Solution {\npublic:\n    int ans; //stores answer\n    void help(vector<int>& tasks,int idx,vector<int>& v,int Time)\n    {\n        if(v.size()>=ans)  // after this no optimal answer present\n            return;   \n        if(idx>=tasks.size())  // if we come to this then it only means v.size()<ans\n        {\n            ans=v.size();\n            return;\n        }\n        for(int i=0; i<v.size(); i++)   // solving for each position in vector v to check \n\t\t// if this gives us optimal answer \n        {\n            if(v[i]+tasks[idx]<=Time)\n            {\n                v[i]+=tasks[idx];\n                help(tasks,idx+1,v,Time);\n                v[i]-=tasks[idx];\n            }\n        }  \n        // maybe optimal solution is after adding element to new position\n \t\tv.push_back(tasks[idx]);\n        help(tasks,idx+1,v,Time);\n        v.pop_back();\n    }\n    int minSessions(vector<int>& tasks, int Time) {\n        if(tasks.size()==1)\n            return 1;\n        int sum=0,i=0;\n        while(i<tasks.size())\n        {\n            sum+=tasks[i];\n            i++;\n        }\n        if(sum<=Time)\n            return 1;\n        ans=tasks.size(); // max answer possible\n        vector<int> v; // to get arrangements of tasks to do\n        help(tasks,0,v,Time); // starting from 0\n        return ans;\n    }\n};\n```
['Backtracking', 'C']