Good day! Could you suggest an algorithm for the following problem: Given two positive integers n, m. It is necessary to obtain a sequence of numbers i, j such that i <= n, j <= m
and for every two terms in the sequence, the condition is:
Used code:
k=(subWidth-1)*subHeight; l=subWidth*(subHeight-1); m=(subWidth-1) if (k>l ) --subWidth; else --subHeight; My solution skips the values, for example for n = 5, m = 6:
5x6=30 5x5=25 5x4=20 4x4=16 missing 3x6 = 18