Originally we have a rectangle with the dimensions 10 cm x 18 cm.
Whenever you make the box, you are taking two congruent squares off each side. This causes two equal lengths, let's call them x, to be subtracted from the original length and width.
So now we have the lengths: 18 - 2x
And the widths: 10 - 2x
The height would be x, as you will see from the figure.
So the volume is l x w x h => (18 - 2x)(10 - 2x)(x)
To find the largest dimensions, you find the x maximum of the cubic equation, and fill that in for x.