In the game of Letter Boxed from The New York Times, you must connect letters together around a square to spell out words. However, from any given letter, the next letter cannot be on the same side of the square.
Consider the following diagram, which consists of eight points (labeled A through H), two on each side of the square. A valid “letter boxed” sequence starts at any of the eight points, and proceeds through all of the other points exactly once. However, adjacent points in the sequence can never be on the same side of the square. The first and last points in the sequence can be on the same side, but do not have to be.
As an illustration, AFBCHEDG is a valid sequence of points. However, AFBCHGED is not a valid sequence, since H and G are adjacent in the sequence and on the same side of the square.
How many distinct valid “letter boxed” sequences are there that include all eight points on the square?
I wrote code that did the following :
Instead of two points on each side of the square (and eight points in total), now there are three points on each side (and twelve points in total), labeled A through L in the diagram below.
How many distinct valid “letter boxed” sequences are there that include all 12 points on the square?