NeetCode #153LC-2364MediumArrays & Hashing
← Back to All Problems#153 · #2364 · Count Number of Bad Pairs(统计坏数对的数目)
📌 Problem Statement & Constraints
You are given a 0-indexed integer array
nums. A pair (i, j) is bad if i < j and j - i != nums[j] - nums[i]. Return the total number of bad pairs. Constraints: 1 <= nums.length <= 10^5, 1 <= nums[i] <= 10^9.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!