There are more than 10 and fewer than 40 children in Mr Patel's class.

Mr Patel puts his class into groups.

When they are in groups of 5, there are 4 children left over.

When they are in groups of 4, there is 1 child left over.

How many children are in Mr Patel's class?

(the answer is 29 but how do i get the answer without trial and error and algebra)?