2364. Count Number of Bad Pairs
Medium
You are given a 0-indexed integer array nums
. A pair of indices (i, j)
is a bad pair if i < j
and j - i != nums[j] - nums[i]
.
Return the total number of bad pairs in nums
.
Example 1:
Example 2:
Constraints:
1 <= nums.length <= 10^5
1 <= nums[i] <= 10^9
解題
Runtime: 119 ms, faster than 100%
Memory Usage: 14.1 MB, less than 16.67%
Previous2359. Find Closest Node to Given Two NodesNext2375. Construct Smallest Number From DI String
Last updated