Referring to this problem , the answer seems to be n*n/2 - 1 (for n > 1) .
Can someone explain the intuition behind this solution, or is it just guessed by observing some small inputs and outputs?
Referring to this problem , the answer seems to be n*n/2 - 1 (for n > 1) .
Can someone explain the intuition behind this solution, or is it just guessed by observing some small inputs and outputs?