Easy C++ Solution|| Sorting || Binary search
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int minimumEffort(vector<vector<int>>& tasks) {\n        int n=tasks.size();\n\n        vector<pair<int,int>>v(n);\n\n        for(int i=0;i<n;i++)\n        {\n            v[i]={tasks[i][0],tasks[i][1]};\n        }\n        auto cmp=[&](pair<int,int>&p1,pair<int,int>&p2)\n        {\n            if(p1.second-p1.first !=p2.second-p2.first)\n            return p1.second-p1.first > p2.second-p2.first;\n            else \n            return (double)p1.second/(double)p1.first < (double)p2.second/(double)p2.first;\n        };\n       sort(v.begin(),v.end(),cmp);\n\n        auto find_ans=[&](int x)\n        {\n            for(int i=0;i<n;i++)\n            {\n                if(x>=v[i].second)\n                x=x-v[i].first;\n                else\n                return false;\n            }  \n            return true;\n        };\n        \n        int l=1,h=INT_MAX,ans=INT_MAX;\n\n        while(l<=h)\n        {\n            int mid=l+(h-l)/2;\n            if(find_ans(mid))\n            {\n                ans=min(ans,mid);\n                h=mid-1;\n            }\n            else\n            l=mid+1;\n        }\n    return ans;\n\n\n    }\n};\n```
['C++']