Official algorithmic problem description and constraints.
Rudolf has two pockets with coins. In the left pocket, there are π coins with denominations π1,π2,β¦,ππ
In the right pocket, there are π coins with denominations π1,π2,β¦,ππ.
He wants to choose exactly one coin from the left pocket and exactly one coin from the right pocket (two coins in total).
Help Rudolf determine how many ways there are to select indices π and π such that ππ+ππ β€π.
Detailed video explanations, mathematical intuition, and clean C++ implementation code.