Code for the Advent of Code event
aoc advent-of-code
at rust 12 lines 214 B view raw
1#!/usr/bin/env ruby 2# frozen_string_literal: true 3 4offsets = $stdin.readlines.map(&:to_i) 5index = 0 6steps = 0 7while index >= 0 && index < offsets.size 8 index += (offsets[index] += 1) - 1 9 steps += 1 10end 11 12p steps