values. A pair of indices (i, j) is a **steep drop** if i < j and values[i] > 2 · values[j], meaning the earlier number is strictly greater than twice the later one.
Return the number of steep drops in the array.values=[9, 4, 2, 5] → 2
The pairs (0, 1): 9 > 2 · 4 and (0, 2): 9 > 2 · 2 count. The pair (1, 2) does not: 4 is not greater than 2 · 2, and a tie is not enough. Total: 2.
values=[1, 2, 3, 4] → 0
The array is increasing, so no value exceeds double a later one.
values=[3, -1, 0] → 2
3 > −2 and 3 > 0 hold, while −1 > 0 does not, giving 2 pairs.
values=[9, 4, 2, 5]
2
Run checks the first 3 tests in your browser. Submit checks all 129 tests on the server, hidden ones included.