cur to 0, i to 0, and j to 0. These variables represent the current number of boxes, the total number of boxes on the floor, and the size of the last layer, respectively.cur is less than n, increment j by 1, add j to i, and add i to cur.cur equals n, return i as the result.i from cur and j from i.j to 0.cur is less than n, increment j by 1 and add j to cur.i and j as the final result.