🔥🔥Easy Solutions in Java || Beats 75.85%
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 {\n    public int[] successfulPairs(int[] spells, int[] potions, long success) {\n        int n = spells.length;\n        int m = potions.length;\n        int[] pairs = new int[n];\n        Arrays.sort(potions);\n        for (int i = 0; i < n; i++) {\n            int spell = spells[i];\n            int left = 0;\n            int right = m - 1;\n            while (left <= right) {\n                int mid = left + (right - left) / 2;\n                long product = (long) spell * potions[mid];\n                if (product >= success) {\n                    right = mid - 1;\n                } else {\n                    left = mid + 1;\n                }\n            }\n            pairs[i] = m - left;\n        }\n        return pairs;\n    }\n}\n```
['Java']