Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Solution {
- public static int MOD = (int) 1e9 + 7;
- public int solve(int[] A, int B) {
- int count = 0;
- int i = 0, j = A.length - 1;
- while (i < A.length && j >= 0) {
- if ((long) A[i] * A[j] >= B) {
- j--;
- } else {
- count = (count + j + 1) % MOD;
- i++;
- }
- }
- return count;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement