d1

Imports

Imports #

"bufio"
"fmt"
"io"
"log"
"slices"
"strconv"
"strings"
"advent2024/pkg/solver"
"context"
"fmt"
"io"
"slices"
"strconv"
"advent2024/pkg/solver"

Constants & Variables

day var #

var day = "d1"

Structs

PuzzleStruct struct #

type PuzzleStruct struct {
input *[2][]int
}

PuzzleStructWithCtx struct #

type PuzzleStructWithCtx struct {
PuzzleStruct
}

Functions

Init method #

func (p *PuzzleStruct) Init(reader io.Reader) error

InitCtx method #

func (p *PuzzleStructWithCtx) InitCtx(ctx context.Context, reader io.Reader) error

NewSolver function #

func NewSolver() *PuzzleStruct

NewSolverWithCtx function #

func NewSolverWithCtx() *PuzzleStructWithCtx

Solve method #

func (p *PuzzleStruct) Solve(part int) (string, error)

SolveCtx method #

func (p *PuzzleStructWithCtx) SolveCtx(ctx context.Context, part int) (string, error)

difference function #

func difference(i int, j int) int

histogram function #

func histogram(l []int) *map[int]int

init function #

func init()

init function #

func init()

inputCopy method #

func (p *PuzzleStruct) inputCopy() *[2][]int

parseInput function #

func parseInput(sc *bufio.Scanner) (*[2][]int, error)

similarity function #

func similarity(v int, h *map[int]int) int

validateInput function #

func validateInput(entries *[2][]int) error