Tap here to switch tabs
Problem
Submissions

Problem: Count Number of Bad Pairs

Try to solve the Count Number of Bad Pairs problem.

Statement

Given a 00 indexed integer array nums, a pair of indices (i, j) is considered a bad pair if i<ji < j and j−i≠j - i \neq nums[j] −- nums[i].

Return the total number of bad pairs in nums.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Number of Bad Pairs

Try to solve the Count Number of Bad Pairs problem.

Statement

Given a 00 indexed integer array nums, a pair of indices (i, j) is considered a bad pair if i<ji < j and j−i≠j - i \neq nums[j] −- nums[i].

Return the total number of bad pairs in nums.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9