Beats 100% || Binary Search || C++
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    vector<int> answerQueries(vector<int>& a, vector<int>& query) {\n        \n        int n=a.size();\n        int m=query.size();\n         sort(a.begin(),a.end());\n        for(int i=1;i<n;i++)\n          a[i]+=a[i-1];\n       \n        vector<int> ans;\n        for(int i=0;i<m;i++)\n        {\n            int k=query[i];\n            auto x=upper_bound(a.begin(),a.end(),k);\n            ans.push_back(x-a.begin());\n\n        }\n        return ans;\n\n    }\n};\n```
['Array', 'Binary Search', 'Python', 'C++', 'Java']