Counting complement pairs
In the array [2, 4, 3, 5, 6, 4, 1, 7], how many unordered pairs of distinct positions with have ?
Show hints (2)+
- For each element, count how many earlier elements equal its complement .
- Watch the two 4s: they form a valid pair since they sit at different positions.
Answer
Reveal answer →Final answer
4
Create a free account to see the full worked solution and track your progress.
Interview format: Market Maker, Systematic & Data-Driven Trading