Skip to content

Commit c43a1b7

Browse files
authored
Add 2023/24 py
1 parent a37254b commit c43a1b7

File tree

22 files changed

+361
-12
lines changed

22 files changed

+361
-12
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"pdir",
3838
"ppos",
3939
"pprev",
40+
"rint",
4041
"starte",
4142
"Vandermonde"
4243
],

2015/24/part2.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env ruby
22
# frozen_string_literal: true
33

4-
# Props to https://www.reddit.com/r/adventofcode/comments/3y1s7f/comment/cy9sqq2/?utm_source=share&utm_medium=web2x&context=3
4+
# Props to https://www.reddit.com/r/adventofcode/comments/3y1s7f/comment/cy9sqq2/
55
def min_quantum_packing(packages, groups)
66
group_size = packages.sum / groups
77
(1..packages.length).each do |len|

2019/16/part2.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
BASE_PATTERN = [0, 1, 0, -1]
99
OFFSET_LEN = 7
1010

11-
# h/t https://www.reddit.com/r/adventofcode/comments/ebf5cy/comment/fb4awi4/?utm_source=share&utm_medium=web2x&context=3
11+
# h/t https://www.reddit.com/r/adventofcode/comments/ebf5cy/comment/fb4awi4/
1212
# The key insights are
1313
# * we can skip computing values before the offset
1414
# * The offset is so large, that to calculate each digit in a phase is just the sum in that unitriangular matrix.

2019/19/part2.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env ruby
22
# frozen_string_literal: true
33

4-
# h/t https://www.reddit.com/r/adventofcode/comments/ecogl3/comment/fbdmn5n/?utm_source=share&utm_medium=web2x&context=3
4+
# h/t https://www.reddit.com/r/adventofcode/comments/ecogl3/comment/fbdmn5n/
55
# Algorithm:
66
# * Fit the SHIP_DIM * SHIP_DIM square by moving it diagonally down.
77
# x

2020/13/part2.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env ruby
22
# frozen_string_literal: true
33

4-
# h/t https://www.reddit.com/r/adventofcode/comments/kc4njx/comment/gfnbwzc/?utm_source=share&utm_medium=web2x&context=3
4+
# h/t https://www.reddit.com/r/adventofcode/comments/kc4njx/comment/gfnbwzc/
55

66
def ext_gcd(a, b, values)
77
d = a

2020/23/part1_array.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env ruby
22
# frozen_string_literal: true
33

4-
# h/t https://www.reddit.com/r/adventofcode/comments/kimluc/comment/ggrzza7/?utm_source=share&utm_medium=web2x&context=3
4+
# h/t https://www.reddit.com/r/adventofcode/comments/kimluc/comment/ggrzza7/
55
# The array cups has index being the cup label and the value is the clock-wise next neighbour.
66

77
require 'set'

2021/08/part2.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
'9' => 'abcdfg' # Len = 6
1515
}
1616

17-
# h/t https://www.reddit.com/r/adventofcode/comments/rbj87a/comment/hnpad75/?utm_source=share&utm_medium=web2x&context=3
17+
# h/t https://www.reddit.com/r/adventofcode/comments/rbj87a/comment/hnpad75/
1818

1919
count_map = DIGIT_MAP.map(&:last).join.chars.group_by(&:itself).map { |k, v| [k, v.length] }.to_h
2020
countpattern2digit = DIGIT_MAP.map do |digit, pattern|

2021/19/part1.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
# end
5959
# end
6060

61-
# h/t https://www.reddit.com/r/adventofcode/comments/rjpf7f/comment/hp58zmu/?utm_source=share&utm_medium=web2x&context=3
61+
# h/t https://www.reddit.com/r/adventofcode/comments/rjpf7f/comment/hp58zmu/
6262
def orient(orient_idx, x, y, z)
6363
case orient_idx
6464
when 0

2023/01/part2_replacement.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22
import fileinput
33

4-
# h/t https://www.reddit.com/r/adventofcode/comments/1883ibu/comment/kbielt0/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
4+
# h/t https://www.reddit.com/r/adventofcode/comments/1883ibu/comment/kbielt0/
55
TEXT_DIGITS = {
66
"one": "one1one",
77
"two": "two2two",

2023/05/part2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def read_seeds_maps():
112112
return (seeds, maps)
113113

114114

115-
# h/t https://www.reddit.com/r/adventofcode/comments/18b4b0r/comment/kc291gz/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
115+
# h/t https://www.reddit.com/r/adventofcode/comments/18b4b0r/comment/kc291gz/
116116
def main():
117117
seed_ranges, maps = read_seeds_maps()
118118
ranges = [(r[0], r[0] + r[1]) for r in seed_ranges]

0 commit comments

Comments
 (0)