Skip to content

dominikb/advent-of-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advent of Code Solutions

2022

Ruby

Day 7

Be careful when using mutable objects as hash keys. They might change out from under you!

hash = {} # => {}
key = [1, 2] # => [1, 2]
hash[key] = 1 # => {[1, 2]=>1}
hash[[1, 2]] # => 1

key.pop
hash[[1, 2]] # => nil
hash # => {[1]=>1}

Day 14

Ranges can be used for accessing multiple array elements except for when they use a negative starting value.

arr = [1, 2, 3, 4, 5]
arr[1..2] # => [2, 3]
arr[-1..2] # => []

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published