d7

Imports

Imports #

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

Constants & Variables

day var #

var day = "d7"

Structs

Equation struct #

type Equation struct {
result int
numbers []int
}

PuzzleStruct struct #

type PuzzleStruct struct {
equations *[]Equation
}

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)

_concat function #

func _concat(i int, j int) int

_solvable function #

func _solvable(res int, acc int, nums []int) bool

_solvablePart2 function #

func _solvablePart2(res int, acc int, nums []int) bool

init function #

func init()

init function #

func init()

parseInput function #

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

solvable function #

func solvable(e Equation) bool

solvablePart2 function #

func solvablePart2(e Equation) bool

validateInput function #

func validateInput(equations *[]Equation) error