Problem 2364 · Medium

Count Number of Bad Pairs

Good pairs share the same nums[i] minus i, so count each key and subtract the same-key pairs from all pairs.

Open the interactive visualisation