Function advent_solutions::advent2017::day05::part1 [] [src]

pub fn part1(jumps: &Vec<isize>) -> usize

In addition, these instructions are a little strange; after each jump, the offset of that instruction increases by 1. So, if you come across an offset of 3, you would move three instructions forward, but change it to a 4 for the next time it is encountered.

For example, consider the following list of jump offsets:

0
3
0
1
-3

Positive jumps ("forward") move downward; negative jumps move upward. For legibility in this example, these offset values will be written all on one line, with the current instruction marked in parentheses. The following steps would be taken before an exit is found:

In this example, the exit is reached in 5 steps.

assert_eq!(part1(&input), 5);

How many steps does it take to reach the exit?