Maximum length of a path inscribed in a triangle Take a look at the shaded triangle shown below. Start at origin and draw an open path inside of it. The path has to be made of straight horizontal and vertical segments of integer length only. Each vertex can be used only once and path segments must not interesect.  

What is the maximum possible length of such path?  
I have managed to construct many different paths of length 30 and I'm pretty much sure that you cannot exceed it (check my example). 
It's also interesting to notice that the base of the triangle has length 10. And if you sum up all even numbers less than or equal to 10 you get... 30. 

Yes, 30 is indeed the maximum.
This problem can also be solved in general. Consider a triangle with base length $2n$ (necessarily even in order to have a right-angled triangle of this type and orientation). The base line contains therefore $2n+1$ grid points, and it is easy to demonstrate that there are $(n+1)^2$ grid points within and on the boundary of the triangle.
If you would colour the grid points black/white in a checkerboard pattern, starting with black in the origin, you will find that there are $(n+1)(n+2)/2$ black and $n(n+1)/2$ white grid points.
Any allowed path will always alternate between a black and a white grid point, hence the maximum path possible would contain all $n(n+1)/2$ white grid points and at most $n(n+1)/2 +1$ black grid points. Hence the total path length cannot exceed $n(n+1)$ and will have to start and end at a black grid point.
We still need to demonstrate that such a maximum path is possible. Hereto start in the origin and go $2n-1$ steps to the right, one step vertical up, $(2n-3)$ steps horizontal to the left, etc and follow a snake-like path to the top.
The total length of the path consists of $n^2$ horizontal unit segments, and $n$ vertical segments and finishes at the top of the triangle. The total length is therefore $n(n+1)$, which is the maximum possible.
Note, that for a triangle with base 10 we have $n=5$ and get a maximum path length of 30.
