Drawing the grid without lifting the pen

contest-matheulerian-pathgraph theory

The below shape consist of $24$ segments with unit length. if we want to draw this shape without lifting the pen, what is the minimum length of the line we should draw?
$1)25\quad\quad\quad\quad\quad\quad2)26\quad\quad\quad\quad\quad\quad3)27\quad\quad\quad\quad\quad\quad4)28\quad\quad\quad\quad\quad\quad5)29\quad\quad\quad\quad\quad\quad$
enter image description here

I think we can do it somehow by segments with the length $28$ (by passing twice the four middle segments on each side of outer big square).

I'm not sure how to solve this problem. is it possible to solve it mathematically or I should just try different ways to draw this?

Best Answer

Notice that if you draw it without lifting the pen, except for the starting and ending point you must draw the same number of lines going into each point as going out. This means that you must draw an even number of segments meeting every point except possibly two. How many extra segments does this imply you need at a minimum? Can you achieve this?