diff options
-rwxr-xr-x | day17/part2 | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/day17/part2 b/day17/part2 new file mode 100755 index 0000000..09fdd88 --- /dev/null +++ b/day17/part2 @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby + +input = gets.chomp.to_i + +buf = [0] +pos = 0 + +50_000_000.times do |num| + p num if num % 100000 == 0 + pos = ((pos + input) % buf.length) + 1 + buf.insert(pos, num + 1) +end + +puts buf[buf.index(0) + 1] |