Official algorithmic problem description and constraints.
You are given an array π΄ containing πintegers.
Count the number of ordered pairs (π,π) such that:
Note that we're counting ordered pairs, meaning the pair (1,2) is different from the pair (2,1).
Detailed video explanations, mathematical intuition, and clean C++ implementation code.