k complete rows is (k * (k + 1)) / 2.(k * (k + 1)) / 2 <= n to find the maximum k.(k + 0.5)^2 - 0.25 <= 2 * n.k + 0.5 <= sqrt(2 * n + 0.25).k.k is an integer, since we cannot have a fraction of a row.k as the number of complete rows that can be built.