Documentation ¶
Index ¶
- func GetInput(filename string) ([]string, error)
- func GetInputAsSections(filename string) ([][]string, error)
- func Volume(p Point3D) int
- type Deque
- type IntervalTreeNode
- type LinkedList
- type LinkedListBuilder
- type LinkedListNode
- type Matrix
- type NodeVisitor
- type Point3D
- type Point4D
- type Range
- type StringStack
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetInputAsSections ¶
GetInputAsSections returns back the input as a slice of string slices, where each top-level slice represents a section of the input. Useful for puzzle inputs with multiple sections e.g 2020 day 19.
Types ¶
type Deque ¶
type IntervalTreeNode ¶
type IntervalTreeNode struct { CenterPoint int CenterIntervalsByMin []*Range CenterIntervalsByMax []*Range Left *IntervalTreeNode Right *IntervalTreeNode }
IntervalTreeNode stores a set of intervals in a binary tree for simplified retrieval.
func NewIntervalTree ¶
func NewIntervalTree(input []*Range) (*IntervalTreeNode, error)
NewIntervalTree returns the root of an interval tree containing all specified intervals, provided all intervals are valid.
func (*IntervalTreeNode) Find ¶
func (i *IntervalTreeNode) Find(query int) []*Range
Find returns a slice of intervals containing the given point, inclusive of bounds.
func (*IntervalTreeNode) FindRange ¶
func (i *IntervalTreeNode) FindRange(query *Range) []*Range
type LinkedList ¶
type LinkedList struct { Head *LinkedListNode Tail *LinkedListNode }
func (*LinkedList) String ¶
func (l *LinkedList) String() string
type LinkedListBuilder ¶
type LinkedListBuilder struct {
// contains filtered or unexported fields
}
func (*LinkedListBuilder) AddItem ¶
func (b *LinkedListBuilder) AddItem(data int) *LinkedListNode
func (*LinkedListBuilder) GetList ¶
func (b *LinkedListBuilder) GetList() *LinkedList
type LinkedListNode ¶
type LinkedListNode struct { Data int Next *LinkedListNode }
type Matrix ¶
type Matrix struct {
// contains filtered or unexported fields
}
func NewMatrixWithoutFrame ¶
func (*Matrix) FlipHorizontal ¶
func (m *Matrix) FlipHorizontal()
func (*Matrix) FlipVertical ¶
func (m *Matrix) FlipVertical()
type NodeVisitor ¶
type NodeVisitor func(int)
type Point3D ¶
type Point3D struct {
X, Y, Z int
}
Point3D represents an arbitrary point in 3D space
type Point4D ¶
type Point4D struct {
X, Y, Z, W int
}
Point4D represents an arbitrary point in 3D space
type Range ¶
Range encapsulates the min and max values for an interval and allows the user to specify some sort of metadata.
func (*Range) Contains ¶
Contains will establish that the given query falls in the bounds of the Range, inclusive of min/max.
type StringStack ¶
type StringStack []string
StringStack is a stack that...well, it holds strings.
func (*StringStack) IsEmpty ¶
func (s *StringStack) IsEmpty() bool
IsEmpty returns true when the stack has no items, false otherwise.
func (*StringStack) Peek ¶
func (s *StringStack) Peek() (string, bool)
Peek will let us see the most-recently added item without removing it from the stack.
func (*StringStack) Pop ¶
func (s *StringStack) Pop() (string, bool)
Pop removes the most-recently added item from the stack and returns it. If the stack is empty, we'll return an empty string and a false boolean.
func (*StringStack) Push ¶
func (s *StringStack) Push(input string)
Push adds a new item to the top of the Stack