Source: Hill Climbing Algorithm
Part 1
Given a height map, find the shortest path between two points such that the path can descend any distance but can only climb by a maximum of 1.
Given a height map, find the shortest path between two points such that the path can descend any distance but can only climb by a maximum of 1.
Simulate a collection of ‘monkeys’. Each monkey will have a number of items which it will then apply a mathematical operation to, then always divide by 3, then test divisibility to pass to one of two other monkeys. Return as answer the product of the two highest number of times a monkey applies it’s main function to individual items after 20 steps.
Note: Monkeys will always be evaluated in order (so monkey 1 will evaluate any items passed by monkey 0 again in the same round).
Implement a simple virtual machine with two instructions:
nop
which does nothing for 1 cycles andaddx $n
which adds$n
to theX
register (initial value 1) in two cycles. Calculate the sum ofcycle * X
for the cycles 20, 60, 100, 140, 180, 220.
Simulate two connected links such that whenever the first link (head) moves, the tail moves to follow according to the following rules:
Count how many unique spaces are visited by the tail
of the link.
Given a grid of numbers, count how many of these numbers have a direct path in any cardinal direction to the edge of the grid.
Give the output of a very simple shell with only the commands
cd
andls
(the output of which is either"dir" name
for directories orsize name
for files), find the largest directory (disk usage calculated recursively) with a size no greater than 100,000.
Given input as a list of characters, find the index of the first sliding window (size 4) where all of the characters are distinct.
Given a list of stacks of syntax 1 and instructions in the form syntax 2, apply each instruction to pop
qty
items from the stacksrc
and put them ondst
one at a time.
Syntax 1: Stacks
[D]
[N] [C]
[Z] [M] [P]
1 2 3
Syntax 2: Instructions
move 1 from 2 to 1
move 3 from 1 to 3
move 2 from 2 to 1
move 1 from 1 to 2
Given a list of pairs of spans (of the form a-b,x-y) count how many spans have one span entirely contained within the other.
Take a list of characters. For each line, split the line exactly in half and find the one character that’s in both halves. Assign a-z to values 1-26 and A-Z to 27-52. Sum these values.