Something very similar was my first programming project in college! The easiest method that most of us did was to brute force it and see if the ends were in the same location and angled correctly. Apparently there was a O(n) method that uses discrete mathematics but I didn’t really
understand it at the time. It really is a great puzzle to solve.
Not my first project, but an assignment in the first year. It was about minimizing coin change. I had a solution very different from the others, and the teacher wrote something along the lines of "I suppose that'll work too" on my solution. Can't remember what I came up with, though.
Calculate smallest coinage (in terms of value of each coin) amount and progressively replacing them with the next higher amount? 2x1 cent -> 1x 2 cents, 2x2 cents +1x1 cent -> 1x5 cent and so on, maybe?