Giving tle in last 10 testCases
Giving tle in last 10 testCases...can someone tell what should i do?\nThanks in advance!!\n\nclass Solution {\npublic:\n    vector<int> maximumSumQueries(vector
Giving tle in last 10 testCases...can someone tell what should i do?\nThanks in advance!!\n```\nclass Solution {\npublic:\n    vector<int> maximumSumQueries(vector<int>& nums1, vector<int>& nums2, vector<vector<int>>& q) {\n        int n = nums1.size(); \n        int m = q.size();\n        vector<pair<int, int>> v(n);\n        for (int i = 0; i < n; i++)v[i] = {nums1[i], nums2[i]};\n        sort(v.begin(), v.end());\n        vector<int>ans(m);\n        for (int i = 0; i < m; i++) {\n            pair<int, int> temp = {q[i][0], q[i][1]};\n            int x = lower_bound(v.begin(), v.end(), temp) - v.begin();\n            if (x >= n)ans[i] = -1;\n            \n            int sum = -1;\n            while (x < n) {\n                if (v[x].second >= q[i][1])sum = max(sum, v[x].first + v[x].second);\n                x++;\n            }\n            if (sum == -1)ans[i] = -1;\n            ans[i] = sum;\n        }\n        return ans;\n    }\n};\n```
['Binary Search', 'C', 'Binary Tree']