Hints

2022 Challenge

Day 4 — Obsessing over Connect 4

To help you debug your code, the answers for the first 20 rounds are available on the subreddit

Day 5 — Spot the forgery

Learn how to use the SHA256 hashing function for your language of choice:

Day 9 — Lost in an alien market!

If you have not used graph traversal algorithms before, I strongly encourage you to find a tutorial about Breadth First Search before continuing.

2022 Practice Round

Snakes and ladders

A video walkthrough for learning how to solve this problem is available here.

Wordle with friends

A video walkthrough for learning how to solve this problem is available here.

Survey an asteroid belt

A video walkthrough for learning how to solve this problem is available here.

Lost in transmission

A video walkthrough for learning how to solve this problem is available here.

Message from afar

A video walkthrough for learning how to solve this problem is available here.

2023 Challenge

  • There are 52 values that should pass the parity check.
  • Remember to remove that parity bit when set before finding the average.
  • In this problem, the parity bit is the most significant bit.

Tic tac toe

As a sanity check to test your code with, the results of the first 10 games are as follows:

  • Game 0 won by X
  • Game 1 won by X
  • Game 2 won by O
  • Game 3 won by X
  • Game 4 won by X
  • Game 5 draw
  • Game 6 won by O
  • Game 7 won by X
  • Game 8 won by X
  • Game 9 won by X

Mayday!

  • There are only 6 packets that should pass the checksum validation process.
  • Paste the entire string of the decoded message. Take care not to include any extra characters. It must be a 100% match. (It starts with a T and ends with a .)

Avoid the asteroids

At time=3600 seconds (the one hour point), the 100 x 100 region of space would resemble the following (. indicates a safe location and # indicates a not-safe location).

t = 3600
.........#.#.#.......................#.............#...........##..#...#..........#...#...##......#.
......#........................................#....#...........#........#....#...#...#....#...#....
.........#.......#...#.......###..................#..#..........#..#....#....##...............#.....
.#.#..#.............#....#........#..............#..............#.#..........#.#....................
......##.#...###..........#...........#..#...#................#..............#......#...............
#...#...........#..#.#.#.......#.#..............#..........#..#......#...#..........................
..............#.#...................#.....#..................#.....#......................#..#......
......................##.#.....#............................#.#.....#..#..............#.............
............##..#.......#...........................................#.#...#.......#...#.............
.............#.......##....#..#..#...#..............#..........#.#.......#....#......#.........##...
..#......#.........#...#.#....#...#...#....#......#...#....#......#..........#.#...................#
..........#.............##....##........#...#.#...............#...........##.......##........#......
.....#.......#....##..#.........##..........#...............#..............#..........#....#........
.....#.........#..###..................#...#...................#.#............#.#.#...........#.#...
...#.....#.....#.............#......#.......................#..##.#.......##.#......................
#.......#....#...............#....##..#..............#......................#.##.....##.............
.###..............#.#.......#..............................#.#.............................#...#....
..#..#.......#..............#...............#................#.........#.......#..#..............#..
.#.........#.....#...#.............#................................#........#.............#....##..
#.........#.#......#.......#...#..#....#.#............#.#..................#..............#.#.....#.
......#........#.........#.#.#....#............................#........#..##.....#........#......#.
..........#..........#........#..#....#........#..#..#.....#.#..#..#.#...........#....#.......##....
.............#.......#..#..#.....##........#...#.......................#.#......#..................#
.............#.......#.#...#....##..........................#.......#......................#.....##.
..............#..............#...................#..........#....#.............#...##...........#.#.
........##..#....#....#....##.#.#.....#..................................#......##..................
......#....#.............#............#.#................................#..........#......#.....#.#
#.......#...............#...#.....#..............#...................................#.#.#...#..#...
#...........#.#.......#...............#.#...................#.................#...#...#.............
.....#...#.....................#......#...................#..#.#..#.........##.....#..#.#.##........
.#.........#..............#.......#.#.......#.................#...........#.....................#...
........#....................#...#.......................................#.......#......#.#....#....
#.................#......................#....#..................................#.....#......#.....
.#.#............#................#........................##.....#.......#..#.....#.............#...
........#.................#.#....#.....#...................................##..#..............#.....
..............................##.#..#.....#..##...........................#.......#...#.#.#.........
#..............#...........#.#...##.................................#.##...................#.#..#...
#........#.............#............###........................#.#............#...........#.........
.##.................................#..............................##......#...........#............
....#.....#..##...........#..#............................................#........#....#.......#...
..#...........#................................................##.#..................#..........#...
...#......#.........................................................................#...............
....................#........#......................................................................
.......#.............##........................................................................#....
..........................................#.....#..........#...................#.........#..........
.......................#....#....#....#..............................#....#...........#........#....
....................#........#.....#..##.........#....................#.............................
................#.......................#.........................#..#..................#...........
..................#......#.......#.......#........................................................#.
................................................#...#.........#.....#...#......#.....#..............
...................##...........................................#...................................
.......#................#...............#...........................#....#.........................#
.....#..............#.................#.........#................................##...#.............
..##.........#..#...........#.........#..........................#..#..........................#....
.#...##....#..............#............................................#..............#..#.....##...
...............#......#.................#....#..............#.#.....................................
#....##..............................#...........#.........#........................................
.........#.....#...................................................#.............#.#................
...............#.................#...#...........#..........#........#....#.................#.......
..............#...#..........#....###.....#....#.................#..#................#.......#......
................#.....#...#................#..#..#...............#.#..#..#.#.....................#..
.............................#......#...#..........................##..............#................
........#...................................#.........................#..............#.......#..#.#.
....#..#..............##....#.............................#..#...............................#......
...........#..#.#.#..................#...#...#................#.........#.#.....##..#...............
.......#..#..............................................#..#.#...............#.........#...........
....#.....#.................##...................#............#.....#....#.....##...#....##.........
.................#.#..#.#.........#.#........#......................#..............................#
#................##.....................##....................#....................#..#....#........
......##.....#..#..#...........#.......#...........................#...........#..#..##..#...#......
.........#.##..............#...#........#................................#.#.#.....#......#.....#.#.
.......#........#.#.....#..#..#.....##.#.....#....#.......#....#......#....#..........#..........#.#
..#........#...............................................##.......#....#..#.........#..#.#.......#
..........................#.#.........#....................#......#..#....#......................##.
......#.....#......#......................................#...#..........##......#...#...#.........#
...........#............#.#..........#...........................#........##.................#.#..#.
.#.#......#...........................#...........#..............#........#.....#................#..
..................#...........#.........#...#.#........................#..#.............#...........
.#...#....#....#.#...........#.....................#.....#.........#..#.........#..........#........
...............#..#....#..#..#...............#.#.............#....#............#...........#........
......#....#......#.............#............#..................#....#.......#.#.......#...#........
........#...................#......#.#........#.....#...........#.....##....##..#..............#....
...#..........#....#.#........................#...........#.............#.......................#...
..........#.....................#...........#..................#..#...#.......#..#..##.........#....
.......#......#...............#..#.....#.#...................##....#...........##....#..........#...
......#.......#........#.....#.#.........#...................#......#....#..#..#.#..............##..
........#.................#..........#.....#...................#....#..........###.......#..#.......
....#.....##.......#..........#........#.................##.#......#......##..........#..#..........
....#....................##......#......#.....#....#....#.......#.....#............#...........#....
#.....................#.##................................#.....#.......#...............#...#.......
..#..##.......#..#..#...........#......#...#...#............#.................##.....#.......#.#....
................#...#.......#..#........#......#.........#...#.......#.#................#....#.#....
.....#.............#..........#...#.....#......................#.......#.#.#.....................#..
..#...#......#........#..#.#.#....#........#..............#....#.........#.......#....#....#....#...
.........#....#....##..................##...........................#.#................#.......#....
..#.........#........#........................................#......#...........##...#....##.......
....#...#.........#......#.........................#.............#.......#..#.......#..#.......#....
...........#................................................#........#...#.......#.......#..........
#..................................................#.........#.....#....##..........................
...#.....#.......#....#...............#....##..#........#....#..........#.........##....#.........#.

At time=3610 seconds (after the 10th second of transit), the asteroid belt would look like this.

t = 3610
...##.#..##############.#...#...##.#.#..#..#....##.#..##############.#.#..#....#..#.#.##..###..##.#.
....####..#..##.....#..#.#..##...#.##.#..#.#...###..#.#####################...##.##.#.#...##########
.....##.###..#.#.#..##....#..###########..##...####..#.##.#.....#..##############.#.###..######.#...
.#.###########..#...############.###....#..#...#.#..##.#..#....##.#.#..#..#..#.#..#.#.#.#.######..##
.#....##.###.##############.#.####.##.###########..#.###..#...#...##..#...#..###..#.#.##..###.#....#
##..#.#..##.##..#.##.#.###...###.#...#....##.#.##.#..#.#..#################.##.#..#.#.#...#####....#
##..#.#..#.#.##.##.#.#.#.#....#####.############.....#.#..#.###..####......###.#..#.###...##########
##..#.#..#..###..#######.##...##.#.....#..####.#.....#.#.############..#..#############..######...#.
##..#.#..#..#####.##.#.#####..#####.....#.##.#.#.....#..#.#.#########################.#.#.##.##..#..
###.#.#..#..###.##.#####.#.#..###########.##.###....############.####..####..##...#.#############..#
#####.#..#..####.#############################.#..#..##.#..######.############.#..#.#.#.#.##.###..##
##..#.#..##.###.#.##.###############.##.#.######.....###...##.##.#####################....#..##..###
##..##########################################......###....##.###.####.#..##.#...###########.##.###.
################..##############.##..####.##.#.....#.##....##.##.##################.###########.##..
#..#############...#.##########.##.##.#.#.##.#....#.#.#...###.################..###.#.....##.#.#...#
#...#...##..####...#..##.###################.....#...##..#.############################...#.###...#.
################..###..##.#############.#.##..........#.#..#######.##..#####.###..#.......##.#.#.#..
#.####...#..##.##.##.#..##.#####.###.##.##.##.........##..########..###############.......#.##..##..
#######..#.#####.###.############.##..###.###.........#..############.##..######.###################
###.####.####..#..##...#..##.######...############...##.########################..############.#####
##########.#.#.##.###...##.#####..##..#.##.##.#.....#.####.#####################..#....#.#.####.###.
..##..######..##.##.##...#.#####.####.###########.##.##.##############.#####.###.##...#.#.#.######.#
..###.######.#.#..#..#################....###..##.#..###....##############.#.######..#.#.#..###.####
#.#.###.####.#.##.##.########################..#.#..###....###.###..#####..#.###.##################.
#######..####.############.########.#.##....#..#.#.#.#############.##################..#..###.#.###.
..#...#############################..####...##.#..#.###..#...#.###########...######...#..#####..###.
#####.###.#######.##.###.###########..#.############.##.#....######..#.###..##.####.##.#############
#############..#.#..##.######.###############..#.#...###.....#.###..#..##..#.#############.#########
##....#.########..#..#############..#.#.#.##...#..###########..##..#..###.#..##.#####.###.#.########
#.#..##..##.#.##...#.###.#######.##..############....##...##.####.#############################.####
.#.#..#...###..#....##.#.####.##.####.#...#.#..#....##....#.###############.#...###..##.#.####.##.##
#######.#.###...#....#.#..######.#.##.#....#...#...#.#...#.###.##.##...#.#.##..###..##..########.###
#..#.#..#...##...##..###..####.#.#..###..#..#.##..........###..#..#...############..#..#####.####.##
#######.#...###.#.#..#.#..###.##.#..###......#...###########...###########..##.#####...#######.##.##
##########..#.##.#.#......#.#..#.###########..#.........#.#....##.#..##############.################
.#.#..#.#...#..##.#.#.....#.#.####..#.###.#..###.......#.#.....#..#....#..####..###..##.#.##.#.#..##
###########.#..###.#.#....####.#.##.#####.......#.....#.#......#..#.#.##.##.#...##.###########.#####
##.#.#..###.#.....#.#..############.####.#.......#...#.#.......#.###..#.##.##.##.#.##.#.####.#.#####
####..#.###.#......#.#....#.#..#.####.##..#.......#.#.#...####################...#.#.#.##.##..###...
#.###################.#...###############..#.......#.#.........######################.###########..#
#.###########.###########.#.#..#.##.####.#..#.......#.........###.##.##.#..#.....###.##.#...#.###.##
#####################...#.#.#..#.##...##..#........#.........#.#.####.##..############..#..#.#.####.
#.##..#.#.#...#..#..#....##.##.#.##....##..#......#.........#.#.##.#..#..#.....###.#.#..#.#.....##..
####...############..###########.##....###..#....#.........#.#.##.##..#.#.....###.#..#..##.....##...
#.#.....#.......#..#......#.#..#.##....#.##..#..#############.##.#.#..##.....###.#...#..##.....##...
####.............#..#..##########################........#.################.#############...########
#.#...............#.##############################......#.#.##.....#.##.....#..#.....##.#....#..#...
#.##............###########.............###########....#.#.#......####.....#..#......#..#...#...#.##
..#...............##########################..#.........#.#........#......#..#.......#..#..#....#.#.
###.....................#...#..........#..#....##...#..#.#....#.....#...##.....#.....#..#....#..#...
................#..###########........#...##..##.#....############.##....#...........#.......#..####
.......#........#.....#.###########..#..#.##..##.##..............####....#...................#.....#
.....#.##.......#...###########.....#.#...##..####...............#.##....#.......##...#......#....#.
#########################...###########...##..####.#...###########.##....#...........###########..#.
.##..#####.##############.############....##..##.#..#.....#.....##.#######.......#..#.###########.#.
.#..#..##...#..##...#.############..#...###########..#....#.#.#..#.##.####....#..#..#.....#..#..#.#.
####.############..#.##.#....##.#..#.###########.#....#...###.#..#####.###.....#.#..#......#.#...##.
#####.#####..#.###########..##.##.#..#....######.#.....#..#.#.#..#.##.###############.......##....#.
###########.#..###########.#####.##.############.############.#..#.###.####......#..#......###....##
##########.#..#.#.##.##...##.##.#.##############.#.....###########.###..##############.....#.##...##
####...##.#....##.#.###..############....#.#.##.##.......############.#.##.###..##.##..############.
###...####....#..#.###..##..####.##.##.##.#..#.#.#.......############..####.###..#.####....#.#..#.#.
##...####....#..#.####.##..#.####.#.#..#.#..###..#........#.#.#...#####.##.#########################
#...##.#....#..#.####.###.#.####..##..###....#..###.....#.#####....##.#.###.#.####.##.##...#.#..#.##
....#.##...#..#.####.##.##.#.###..#..###########.#.############.....##.####..#.###..#.####.#....#.##
...#.#.############.##..#.#.####.##.#.##...#.##..#..#....#########..###.###...#.###..##.####....#.##
..#.#..#..###########..##########.##.#.#..#..#...#...#....##################################....#.##
.#.#...#....#.##############..##..#.#..#.#..###.......#...####.#.####..####.....###.#.##############
###....#...#.###.############.##.#.....###.#..#....############.#####...####....##.#.##.##.###..#.##
.#....############################################.#....####.###.#.###...###################.##.#.##
##########.###..#.##...##.#######......#############.....###..######################.##...##...##.##
.#....###..##..##.#...###.##.##.#...############..##.....###############..##..#####...#..###########
###############..##..#.####..#..#....#.#....####..############.############.#..###########.#########
.#..###....###..#.#.##.##.#.##..#...#.#....#####...#.#...###..#..#####.#####...###..##.############.
####################.#.##.##.#..#..#....###.####...####################################..#.#.#######
.####.#...##..#.#.#..####.#..#.##.#..#.#.#..####...#...#.#....####.#.###.#####.##.#...##############
.#####################.#.##..#.###...##.##..####..###...##....#.##.######.#.#####..#...##..##...##..
##....#.#..##.#.#.#.##.##.#..#######################.#...#....#..###.#.##########...#...##.##...###.
##...######################.############.#..#####..#..#.###.#.#...##.############....#...####...#.##
#.....#...######..#..###.###.#####.#.##..#..####.......##.##.##...####....####.###....#.#####...#..#
..#..##..#.###..##############.####.##...##.####.#....###########..################..#.###.###..#...
..###...#.###..#.#..##...##.#..#.#.##############...#...###..####..#.###...###.##.##.############...
####.#...###..#############..#.#####.#..##..#.##........#.#...#.#..#.####..######..#######..########
.##..#.####.##...#..#..#.##.#..####..#.#.#.##.##........#.##############...##.####..##.####.##.##...
#.#..#####.#################.###.###########.#.#.#......############.#.##..###.###...###############
.##..###.###.######################..#...####..##.......#.#..#.....###.###.##.####...#########..###.
#.#.###.###########.#....#############..##.#...#.....#################.#.#.#...###...#.#######....##
..####.##############...###...#..###...##.##..##..###########..########################.##.#########
..#.######.###...##.#..#.###########...###.#.###...#....#.#.#...#....###.###########.#..###.####....
####.###.#.#.#...##.#.#############...#.#..##..#....#.####################..#....###############.###
#.#######################.......#.#..###...#...#.....#....#.#.#...#.############.#.#.#..#..######...
..####.###.###..###########.################...#...###########.#...#.###.##...#..#.##...#...##.#.###
..##.#####.#.#...#####........#...##..#.##.#...#.......#..#....##...##.#.#.#...#.#.#.#.############.
.###.###.###.#...##.#.#..#.############.#..#...#........#.#....############.########################
########.#.####.#####...............#.###..##.##.........##############..#.#.#...#.#...#....##.#..##
..####.###.############.............#.##...#..##....###########.#..#.#.#.##.#.#..###..#....###..#...
..###..#####.##..##..#.#.#..........###...##..##...#...#########################################.#..
.###..####.#.#...#...#.#............###..#.#..##........#.###.#...#..#.#.#..#.############...##.####
###########.##..##...#.#...........####.#..#..##.#.#...#######.#...#....##.#.#.###.#.#.......#######
##.##..###.#.#.###...####.........######..###.##.#.....##.#.##..##..#...##..#.#####################.

Snakes on a spaceship

Hint #1

If you are getting a score of 6124, it means you are playing all the moves until the end of the dataset. Double check your code that tests for:

  • Going out of bounds
  • Snake colliding into itself

Hint #2

After move #50, the score would be 250 and the board should resemble the following:

....................
....................
.....F..............
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
..........S.........
.........SS.........
....................
....................

After move #100, the score will be 500 and the board will resemble:

....................
....................
....................
....................
..F.................
....................
....................
....................
....................
....................
....................
....................
................SSS.
..................S.
..................S.
....................
....................
....................
....................
....................

Shopping expedition

This is known as The traveling salesperson problem.

The dataset will work with a brute force / exhaustive search approach. You may find Python’s permutations() function in the itertools module useful if you wish to take this approach.

If you are interested in a more elegant solution, consider this as a dynamic programming problem (looking at the example data above you can observe the same calculations are being repeated many times). In addition to dynamic programming, there are several methods of representing this problem that you may find interesting to research into.

Index tree

To help ensure you are processing the data correctly, the first 4 layers of the BST are shown here.

The route home

A commonly used method for solving shortest path problems is Dijkstra’s algorithm. This is a good explanation and example walk through on Youtube How Dijkstra’s Algorithm Works.

2024 Challenge

Broken firewall

Make sure your answer is being submitted as a ratio and without any spaces. Eg if the two numbers were 512 and 2124, you would submit an answer of `512/2124’.

The purge

This problem may look like it is an ideal candidate for recursion, but you will likely hit your maximum recursion depth limits. There are other ways of solving this, in O(n) time, that do not require recursion at all. A dictionary/hashmap may prove useful.

Connecting cities

Learn about dynamic programming, specifically the climbing stairs problem.

Mining tunnels

Learn about breadth first search or path finding algorithms such as Dijkstra’s algorithm.

As per the example, traversing through the elevator to change levels does not cost a step.


Copyright © Paul Baumgarten.