We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This can be solved by using chromatic polynomials and using deletion contraction algorithm. Memoization is necessary as we count polynomial for the same graph many times. In order it to work I had to represent graph in a very consice way as string is used as a key to cache and must as short as possible. By no means this is an easy task. Should be at least marked as hard.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #189: Tri-colouring a triangular grid
You are viewing a single comment's thread. Return to all comments →
This can be solved by using chromatic polynomials and using deletion contraction algorithm. Memoization is necessary as we count polynomial for the same graph many times. In order it to work I had to represent graph in a very consice way as string is used as a key to cache and must as short as possible. By no means this is an easy task. Should be at least marked as hard.