Note that the first input number \(i\) can be greater than the second input number \(j\).
Otherwise, this problem can be solved straightforwardly.