-
Notifications
You must be signed in to change notification settings - Fork 0
/
aoc2022_day06.santa
64 lines (51 loc) · 957 Bytes
/
aoc2022_day06.santa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
input: read("aoc://2022/6")
let is_marker? = |sequence| size(sequence) == size(set(sequence));
part_one: {
4..
|> find(|position| is_marker?(input[position-4..position]));
}
part_two: {
14..
|> find(|position| is_marker?(input[position-14..position]));
}
test: {
input: "bvwbjplbgvbhsrlpgdmjqwftvncz"
part_one: 5
}
test: {
input: "nppdvjthqldpwncqszvftbrmjlhg"
part_one: 6
}
test: {
input: "nznrnfrfntjfmvfwmzdfjlvtqnbhcprsg"
part_one: 10
}
test: {
input: "zcfzfwzzqfrljwzlrfnpqdbhtmscgvjw"
part_one: 11
}
test: {
input: "mjqjpqmgbljsphdztnvjfqwrcgsmlb"
part_two: 19
}
test: {
input: "bvwbjplbgvbhsrlpgdmjqwftvncz"
part_two: 23
}
test: {
input: "nppdvjthqldpwncqszvftbrmjlhg"
part_two: 23
}
test: {
input: "nznrnfrfntjfmvfwmzdfjlvtqnbhcprsg"
part_two: 29
}
test: {
input: "zcfzfwzzqfrljwzlrfnpqdbhtmscgvjw"
part_two: 26
}
test: {
input: read("aoc://2022/6")
part_one: 1848
part_two: 2308
}