JAVA || Clean Code || Binary Search
\nclass Solution {\n    public int[] successfulPairs(int[] spells, int[] potions, long success) {\n        \n        Arrays.sort(potions);\n        int[] res=ne
```\nclass Solution {\n    public int[] successfulPairs(int[] spells, int[] potions, long success) {\n        \n        Arrays.sort(potions);\n        int[] res=new int[spells.length];\n        \n        for(int i=0;i<spells.length;i++)\n        {\n            int count=binarySearch(spells[i],potions,success);\n            res[i]=count;\n        }\n        \n        return res;\n    }\n    \n    public static int binarySearch(int spell, int[] potions, long success)\n    {\n        int i=0;\n        int j=potions.length-1;\n        int n=potions.length;\n        \n        int res=0;\n        \n        while(i<=j)\n        {\n            int mid=(i+j)/2;\n            \n            if((spell*1.0)*potions[mid]>=success)\n            {\n                res=n-mid;\n                j=mid-1;\n            }\n            \n            else\n            {\n                i=mid+1;\n            }\n        }\n        \n        return res;\n    }\n}\n```
['Binary Search', 'Java']