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.
Theare are number of comments about a recursive approach. I used an approach with no recursion or backtracking. If there's a way to see times in the new Hackerrank format, I don't see it, but all my local tests run in a fraction of a second.
I only needed two techniques: Cuts within a single row/column/block (e.g. if 1, 4, and 5 are only possible in 3 cells, the other 6 cells must be 2,3,6,7,8,9), and interactions between blocks and rows/columns. The techniques are applied until no further changes occur (seeing if each is necessary takes more time than just applying them).
I used bitmasks to represent possible values in a row (for example), which allows for high parallelism as well. E.g. once a cut is identified, applying it to the entire row is a &= operation.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #96: Su Doku
You are viewing a single comment's thread. Return to all comments →
Funnest one in awhile!
Theare are number of comments about a recursive approach. I used an approach with no recursion or backtracking. If there's a way to see times in the new Hackerrank format, I don't see it, but all my local tests run in a fraction of a second.
I only needed two techniques: Cuts within a single row/column/block (e.g. if 1, 4, and 5 are only possible in 3 cells, the other 6 cells must be 2,3,6,7,8,9), and interactions between blocks and rows/columns. The techniques are applied until no further changes occur (seeing if each is necessary takes more time than just applying them).
I used bitmasks to represent possible values in a row (for example), which allows for high parallelism as well. E.g. once a cut is identified, applying it to the entire row is a &= operation.