Python || 91.63 % Faster || Binary Search || Prefix Sum
\nclass Solution:\n    def answerQueries(self, nums: List[int], queries: List[int]) -> List[int]:\n        def bin_search(target):\n            l=0\n           
```\nclass Solution:\n    def answerQueries(self, nums: List[int], queries: List[int]) -> List[int]:\n        def bin_search(target):\n            l=0\n            h=len(nums)-1\n            ans=-1\n            while l<=h:\n                m=(l+h)>>1\n                if nums[m]==target:\n                    return m+1\n                elif nums[m]>target:\n                    ans=m\n                    h=m-1    \n                else:\n                    l=m+1\n            return len(nums) if ans==-1 else ans\n        n,m=len(nums),len(queries)\n        a=[]\n        nums.sort()\n        for i in range(1,n):\n            nums[i]=nums[i]+nums[i-1]\n        for i in range(m):\n            a.append(bin_search(queries[i]))\n        return a            \n```\n\n**An upvote will be encouraging**\n
['Binary Search', 'Sorting', 'Binary Tree', 'Prefix Sum', 'Python', 'Python3']