Let's say each row has x desks and there are y rows.
We then know that x*y =25
We also know that x*2-5=y (number number of rows is five less than twice the number of desks in each row)
So we substitute: x*(x*2-5)=25
putting numbers out of the brackets:
2x*x-5x=25
2x*x-5x-25=0
(2x+5)(x-5)=0 (this bracketing is true: you can check it by expanding it:
2x*x-10x+5x-25
So that means that either x=-2.5which can't be : there can't be a fractional number of benches,
or x=5
so each row has 5 desks and there are 2*5-5 rows, or 5 rows.