c++ solution of the problem
can anyone explain why i am getting TLE with this code?\n \n\n static bool cmp(vector<int>v1,vector<int>v2){\n        \n        return ((v1[1]-v1[0])>(v2[1]-v2[
can anyone explain why i am getting TLE with this code?\n \n```\n static bool cmp(vector<int>v1,vector<int>v2){\n        \n        return ((v1[1]-v1[0])>(v2[1]-v2[0]));\n    }\n    int minimumEffort(vector<vector<int>>& tasks) {\n        \n        ios_base::sync_with_stdio(false);\n        cin.tie(NULL);\n        cout.tie(NULL);\n        \n        \n        sort(tasks.begin(),tasks.end(),cmp);\n       \n        int t=tasks[0][1];\n        int c=tasks[0][1]-tasks[0][0];\n        for(int i=1;i<tasks.size();i++){\n            if(tasks[i][1]>c){\n                t+=tasks[i][1]-c;\n                c+=tasks[i][1]-c;\n            }\n            c=c-tasks[i][0];\n        }\n        \n        return t;\n    }\n\n```
[]