Easy Java || Binary Search  || Beats 85%
Intuition\nSolution using basic Binary Search\n\n# Approach\n1. sort the potion array\n2. now iterate for the spell array\n3. binary search the index where the 
# Intuition\nSolution using basic Binary Search\n\n# Approach\n1. sort the potion array\n2. now iterate for the spell array\n3. binary search the index where the multiple of spell*potion>=success\n4. now from that index onwards rest potions will be surely >=success because they are arranged in increasing order\n# Complexity\n- Time complexity:\nO(NlogM)\n\n- Space complexity:\nO(N)\n\n# Code\n```\nclass Solution {\n    public int[] successfulPairs(int[] s, int[] p, long sus) {\n        Arrays.sort(p);\n        int n = s.length;\n        int m = p.length;\n        int[] ans = new int[n];\n        for(int i=0;i<n;i++){\n            ans[i] =m-search(p,sus,m,s[i]);\n        }\n        return ans;\n    }\n\n    int search(int[] p ,long t ,int size, int given){\n        int s =0;\n        int e = size-1;\n        while(s<=e){\n            int mid = (s+e)/2;\n            long mul = (long)given*p[mid];\n            if(mul>=t){\n                e = mid-1;\n            }else{\n                s = mid+1;\n            }\n\n        }\n        return s;\n    }\n}\n```
['Java']