Count Distinct Value Pairs Summing to Target
Asked at Amazon · Coding Questions · Difficulty: Medium
Given an integer array `stocksProfit` and integer `target`, count the number of **distinct value pairs** `(a, b)` with `a + b = target`, where `a` and `b` come from two different indices. A value may pair with itself only if it occurs at least twice. Pairs with the same set of values are counted once regardless of index.
Loading the problem…