chore: add hackerrank solutions
This commit is contained in:
11
aoc2023/day21/example.txt
Normal file
11
aoc2023/day21/example.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
...........
|
||||
.....###.#.
|
||||
.###.##..#.
|
||||
..#.#...#..
|
||||
....#.#....
|
||||
.##..S####.
|
||||
.##..#...#.
|
||||
.......##..
|
||||
.##.#.####.
|
||||
.##..##.##.
|
||||
...........
|
||||
131
aoc2023/day21/input.txt
Normal file
131
aoc2023/day21/input.txt
Normal file
@@ -0,0 +1,131 @@
|
||||
...................................................................................................................................
|
||||
.#.......#..#...#.......#......#....#..#...#...#....#.#..........................................#...............#..........#......
|
||||
.............##..................#......#.#....#.......................##..#........................#......#..........#............
|
||||
......#..........................#....#.....#.............#................##....#.#.............#.........#.##...........#........
|
||||
.#................#............................#...........................#..##.....#..................#..##..#.#.........##......
|
||||
.....#.............#.....##.............##..........#...........#.............#.....#...........#.#.......#....#......#..........#.
|
||||
........#....................#....#.#.#......##........#...........#...........#..........#...#..........#......................#..
|
||||
.........#.#...#.......#........#........##...#...#..##........................................##...#.#........................#...
|
||||
......#.....#..#..#.#..#..............#...#..#.....#...........#.....#........#.#...........#...........#.#...............#.....#..
|
||||
...........#.......####..#.#..............##................#.#.#.....................##.....................#...#..............#..
|
||||
......###...#......#................##...#...#....#...........#...#..............#.........#..#..................................#.
|
||||
...............#..##..........#...........................##......#.##.........................#..#.#...........#.#...........#....
|
||||
...##........#...#...#...##...##...........#..#...................#...................#.#..#.........#.......#..#...........##...#.
|
||||
................#.....#..##......#.....#.....##............#..#..........##...........................#.#.......##.....#.....#.....
|
||||
.#..#.......#.#...#..##.....#............................#......#...#....#................#.#..#.....#.......##................#...
|
||||
...............#.....#........................#..........#.....#..............................................#..................#.
|
||||
.....#......#..........................................#....................................#..#.......#.#..#......#.#....#..##....
|
||||
............##............#.......###.......................#..#....#......................................#..#.........#..........
|
||||
..#...............#.....#...#...#......................#...#.#..............................#.#..#.#.....#.#.#..#....#.....#...##..
|
||||
.#.............................##.................#.......#.......##....#....................#.....#.#........#.....#........#.....
|
||||
.#....##...................##.....#.#..............#.#....#....#..#....#......#..........#.....##............#....#.............##.
|
||||
.........#....#.....#..#.........#....#.#..........#...#...#.......#....#..##.......................#.#..#........#..#....#..#.#...
|
||||
..#..................#.......#..#.#..............##.......#........#..............#.........#..#....#......#..#..........#.........
|
||||
........#.....#......#.....#......#...#.......#....#.......#.#..#................#....................##.............#.......#.....
|
||||
..#.................#..............#...........................................#.....#..................#...#.#..................#.
|
||||
.......#......#.....#...........................#.....#..................#.....................#.....#.#......#........#.#.......#.
|
||||
..#.#.#...................#...#..#................#....#.......#......................#...............#.........##...#.#.....###...
|
||||
.....#...#....##....#........####...........#.................#...#...........................................#..............##....
|
||||
..##.#..#.#..........#.#.#..#................................#..#.............#..#......#...........................#.##...........
|
||||
..............#.............................##........#..##........................#.............................#........#........
|
||||
........#.........#........#..#........#..#........#...#.#........#...........#.........................#.#..........#...#......#..
|
||||
.........##.....#........#.....................#..#.............#.....#........#....................#....#.#.#......#.....#........
|
||||
......................#...................####..#.........#....#.........#...........#..................#..#.................#.....
|
||||
..#.........#...#.....##................##.##....#.....#....#..............................#..#.............#..#...................
|
||||
..........##......#..#..............#.#....#......#................#.....#....#..............#..................#..................
|
||||
.#.#..####...#....................#.#.#.....#...#...................#....#.#.....#.#.......#.#...........#......#.#................
|
||||
.......#.........#..#.#..............###.......#....#.........................#.......#.###...#............#....#.#..#....###.#....
|
||||
........#....#...#......#.................#..........................#.........................#...........##.............#.#......
|
||||
.#..............#.....................#......#.............##............#..#..........#...................#...#....#..............
|
||||
......#..#..#.#...............#........###.......#.#...........#...........#.#.........#..#.....................#......#..#.#......
|
||||
.....#...............#.........#....#..........#.......#.......#......#...#..##.....#.....#........#.#.......#.......#..#...#......
|
||||
..#............#.....................#...#.......#....###...........#.....#.#.................#................#.........#..##.#...
|
||||
..............................#.....#..................................#.....##...............#.......#.........#.....#....##......
|
||||
..#...##...#...#..............#.................##..#......#.................#....#......#...#...#......#..........................
|
||||
.........#....#..............#........#..#...............#....#...#.....#..#......#.........#.......#.#..#........#...........#....
|
||||
........#..#....................#.........#...##.#.#..............#......#.#..........##...##....#......................#..........
|
||||
.##..#....#....#.......##......#............#..#......#.....##..................#####..#...#......#.#...#..........#.#.....#..#....
|
||||
..#...........#....................#.......#......#.........#...............#......#........##........#.................#.....#.#..
|
||||
..#....#.#...............#.#.........................#.............####..............................##................###.........
|
||||
.....#.......................................#....#...##...#.......#.......#.....#.##..##.................#.....................##.
|
||||
.........#...........#..#..##.#..........#..#.........#..#.....#...................................##....#...............#..#.#....
|
||||
.....#..#...........##............#........#..................#............#..........#..........#..#...........#..................
|
||||
............................#.........#...............#..................#.#....#.#..#........#.....#...........#...........#......
|
||||
................#...##.#....#..##..........#.#........##.#..#..#.....................#....#.................#.#...............#....
|
||||
.#.....#..............#.#..........#..#........#...............#..#.#..##..#.#.#.........................#.................#.......
|
||||
....#..............#................#.....#..#.......#..#.#.........#..........#..........#.....#..........##.....#............#...
|
||||
..............##...........#.......#......#..................#.......#.....#.#...#...............#.#........#......#............#..
|
||||
................#.....#....#........#....#.......#.#.##.....#...#..#.##...#................#.#.....#....#.............#............
|
||||
...........#.#.##..####.....#....#.#...#.#...........#...#.......................#.#....#.....#..#................###..............
|
||||
...................#....#..........#.#..##.....#..#..#......###............#..#...........#....#......#............................
|
||||
...........................................#.......#..............#.##.......##.......#...#.....#.#..#.....#..###..................
|
||||
............###........#.......#.#....#.....#....#..#........#.........##....#.....#..........#......#............#..#.#...........
|
||||
............#..........#................##.#..............#.....#................#....................................#..#.........
|
||||
...........#.....#.....................#...#.....#.......#..........#....#.....###.....##.#.##.#.....#......#......#.......#.......
|
||||
.....................#..#.....#...##.....#..#...........#....#....##............##.................##............##................
|
||||
.................................................................S.................................................................
|
||||
........#.#........#..........#.....#......#........#.#............#.#.........##...#............#...#.....#...........#.....#.....
|
||||
..................##.......#......#..#..................#..##......#.........#...#.........#............#....#...........##........
|
||||
..................#...........#.##.......#..............#....................#.#....#...##...#.....#.......#..#.....##.............
|
||||
...........#....#....##...#................................#.........#.................#....#.......................#...#..........
|
||||
.............#.#.#.....#.#...#.......#.#...........#....#.#.........#........##......#.......#.......##...#..........#.##..........
|
||||
...........##.#....#....#..#.....#...............#......................#...........#.....#...........#.#.......#..................
|
||||
.#.......................#.#...##.#....#.#...........#.#....##.##......#........................##....#.#....#.....................
|
||||
...#..................#.#...........##....###.................#....................##......#.....#............#.##....#.......##...
|
||||
.#..................####...#.#..#.##.#...####...#......#....................#..........................#....#......................
|
||||
.....#..........#.....#.#...............#.........##...#......#.#.....#...........#.....#............##......#.....#...............
|
||||
......#........#....#..#............................###.#...##........#........#.................#..#........#...............##....
|
||||
......................#.........................##....#...#..............#..#............#.#....#......##.#......#.........##......
|
||||
..................#....#...#.#.......#..............#..#..#...#.......#...#.....#.....#...............#.#.#...............#........
|
||||
...#...##......................##..##...........#......#.............#............#...........##.......#....#......................
|
||||
.............................##...........##...#...#.....#....#.......#.#..#.....##...............#..#.#......#..............##....
|
||||
...#..#.#...#.......#..................#............#....#.#.##.#.........#......#........#..#..........#....##...........#....#...
|
||||
.....#.............................#......#.#.....#.##.#.................#.........#..#..#.#.#........................#.#.......#..
|
||||
....#........#........#....#.#.#.....#.##............###.#..........#...##......#........##...#.........#.............#........#...
|
||||
..#..............................#.............................#......#...................#...#......#.............#...............
|
||||
.......#...#...............#.................##....................#....##.......#....##....##...#..................#..............
|
||||
.........................#...#..#.....##.............#...##.......#.....#...#..............#.....#.#.#..#........................#.
|
||||
......#.......##.#.............#....................#...#...........#...#..##....#.....#............#...........#........#.........
|
||||
...#....#...#......#........................#.....#.........#......#........#.....#.#...........#.#..............#......#....#.....
|
||||
........#..........#...................#...........##.#..#...#................#....##.............#................#....#..........
|
||||
........#.......#....#.............#..........#...................#.#....#.#........#..#..............................#..........#.
|
||||
............#........#....................#.#.........#......#.............#................#...#.............#....#...............
|
||||
..#..............................#..#....##.....#......................##...#..#.........#......#......................#...#...#.#.
|
||||
.##....#.............#...........##..................#...#..............#.......#................................#.........#.......
|
||||
.....#......#.#.....##...........#.....#.......#..........##..#.............#.#.........#.#.#.............##........#......#..#....
|
||||
.......#.......#.#.#..#......................#....#............##....#...........#.........................#......#................
|
||||
.........##.........#..............#.#.#....#...#.......#.................................#..##..................##.###.##...#.....
|
||||
......................#...#.#.......#..#.#..........#........#.......#.................#..................................#........
|
||||
....##........#.........#.........................#................#......#...#.....#..................................#..#.#......
|
||||
...##..............#..................#...#......#........###..#.......#..........#..............................#......#..........
|
||||
.#.#.#....#..........#......#.#.........#.....#...............................#.....#.#............#....#........#.............#...
|
||||
........#.........#.........#......................#..#......##.....#..#..........................#......##....#......##.##.....#..
|
||||
.##...#.......#.#....#..#.#...................#.........#....#...........#.....#.........#............##......#............#.......
|
||||
.##..#.........#..........#.#.................................#.#.#...............................#............#......##...#.#.....
|
||||
......#........#..#...#............#..............#............#......##.....#.................................#......#.#.....#....
|
||||
..........#........#...........#....................................#.....#...............................#............##....#.##..
|
||||
........#.............#..#......##..................#.............#..#...#.#.....#...#...............#........................#....
|
||||
....#...............#..........#....#...........................#....##.##...................#.#.......#...#.##....#........##..#..
|
||||
......#.....#..#..........###...#.................####.###..........#...........#..........#......#............................#...
|
||||
.#...#......#........#..#............##...............#.##......#...#.....#....................#.........#............#...#........
|
||||
................##...................#.##..............#...#..#.......#.......###........#..#..#........#...##.....................
|
||||
..............#....#..#..#.............##..............#................................#.....#..#....###.##..............#........
|
||||
..#..............#........................................#..........#.....#..................#............#..#....................
|
||||
.........#...#.....#...#...##...........#.###............##...#........#......................##......#....#.......#...............
|
||||
....#....#.....#.......#......................................#.#.#....#..#..#..........#...................#........#...#.........
|
||||
..#..#..................#..............#...#..#.........#......#....#.#................##..........#..#................#...........
|
||||
...#...................#...........#....#...#.............##...#.......#.#..........#..#...............#....#....#.............#...
|
||||
.......................##.#.#..##........#....#.........#.#.#.....##..............#.......#.......##.#..........#.#................
|
||||
.....#..#..................#..##....#.......#.............#...#.....#.............#.............#.#...............#.....##......##.
|
||||
...#.#.....#..........#.#............#..#..........................##.............#....#.......#.#...#...#....................#.#..
|
||||
............##.#............#....#....#....#..##...#...............................#...#...#.........#.......................##.##.
|
||||
....#.#...............#...#.......#............#..#...........................#..............#..........#....#...#...#..#...#....#.
|
||||
.......#..#..#.#..#......#..........................#...............#.........#...........#................#..#...#................
|
||||
...#..#...#.....#.#.......#....................................................#........#..........#.#...#......#..........#.......
|
||||
..#...#.......#..#..............#.#...#.....#...#....#............#..........##...#.........##.............#.......................
|
||||
...#.............#...#....#...#.....#.#.#..............#..........#........#........##...........#..#.#......................#.....
|
||||
.#.......#.................#...............#..........#.....................#.....#............#......##....#.....#...#....###.....
|
||||
...##...........#..........#.#........#............#..#.#........................#.....##............#...##.#.......#.##....#......
|
||||
...........#........#...........#.......#......#...#.....#............................#........#..#................#...#....##.....
|
||||
...##.##.........#.####..#............#..#.....#.......................#......#..........#.#..#.#....##........#....#.....#..#..##.
|
||||
...................................................................................................................................
|
||||
30
aoc2023/day21/main.go
Normal file
30
aoc2023/day21/main.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
_ "embed"
|
||||
"fmt"
|
||||
|
||||
aoc "go.sour.is/advent-of-code"
|
||||
)
|
||||
|
||||
// var log = aoc.Log
|
||||
|
||||
func main() { aoc.MustResult(aoc.Runner(run)) }
|
||||
|
||||
type result struct {
|
||||
valuePT1 int
|
||||
valuePT2 int
|
||||
}
|
||||
|
||||
func (r result) String() string { return fmt.Sprintf("%#v", r) }
|
||||
|
||||
func run(scan *bufio.Scanner) (*result, error) {
|
||||
|
||||
for scan.Scan() {
|
||||
_ = scan.Text()
|
||||
|
||||
}
|
||||
|
||||
return &result{}, nil
|
||||
}
|
||||
41
aoc2023/day21/main_test.go
Normal file
41
aoc2023/day21/main_test.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
_ "embed"
|
||||
|
||||
"github.com/matryer/is"
|
||||
)
|
||||
|
||||
//go:embed example.txt
|
||||
var example []byte
|
||||
|
||||
//go:embed input.txt
|
||||
var input []byte
|
||||
|
||||
func TestExample(t *testing.T) {
|
||||
is := is.New(t)
|
||||
scan := bufio.NewScanner(bytes.NewReader(example))
|
||||
|
||||
result, err := run(scan)
|
||||
is.NoErr(err)
|
||||
|
||||
t.Log(result)
|
||||
is.Equal(result.valuePT1, 0)
|
||||
is.Equal(result.valuePT2, 0)
|
||||
}
|
||||
|
||||
func TestSolution(t *testing.T) {
|
||||
is := is.New(t)
|
||||
scan := bufio.NewScanner(bytes.NewReader(input))
|
||||
|
||||
result, err := run(scan)
|
||||
is.NoErr(err)
|
||||
|
||||
t.Log(result)
|
||||
is.Equal(result.valuePT1, 0)
|
||||
is.Equal(result.valuePT2, 0)
|
||||
}
|
||||
Reference in New Issue
Block a user