copy pasting the rules from last year’s thread:
Rules: no spoilers.
The other rules are made up aswe go along.
Share code by link to a forge, home page, pastebin (Eric Wastl has one here) or code section in a comment.
copy pasting the rules from last year’s thread:
Rules: no spoilers.
The other rules are made up aswe go along.
Share code by link to a forge, home page, pastebin (Eric Wastl has one here) or code section in a comment.
4:
4-1
I tried something clever and was punished for my hubris, but it turned out ok.
I treated the input as a list of strings and searched for “XMAS” and “SAMX”, rotating and transposing the list to scan for vertical and diagonal words.
In my arrogance, I thought I could do the diagonal rotation easily, but I was very wrong. I got it out in the end, though.
4-2
this was easier than 4-1. An O(n2) solution just scanning for X-MAS was good enough. Maybe there was a more clever solution that used, i dunno, string hashing or something but whatever.
re: 4-2
is it really n^2 tho? You have to do a constant check around each element, but that does not increase with the number of elements. And you can optimize a bit by marking already seen 'A’s as illegal states and don’t have to check them when the next row is processed.
i am a simple man
I see square input, i say n2