c++ || Binary search || prefix Sum
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 bs(vector<int>& ps,int target,int low,int high){\n        int ans=-1;\n        while(low<=high){\n            int mid = low + (high-low)/2;\n            if(ps[mid] <= target){\n                ans=mid;\n                low=mid+1;\n            }\n            else{\n                high=mid-1;\n            }\n        }return ans;\n    }\n    vector<int> answerQueries(vector<int>& nums, vector<int>& queries) {\n        int n=nums.size();\n        sort(nums.begin(),nums.end());\n        vector<int> ps(n+1,0);\n        for(int i=1; i<=n; i++){\n            ps[i] = nums[i-1]+ps[i-1];\n        }\n        vector<int> ans;\n        int low=0,high=n;\n        for(int i=0; i<queries.size(); i++){\n            int x=bs(ps,queries[i],low,high);\n            ans.push_back(x);\n        }\n        return ans;\n    }\n};\n```
['Binary Search', 'Prefix Sum', 'C++']