day05

package
v0.0.0-...-02e4340 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LowestLocation

func LowestLocation(input []string) int

LowestLocation returns the lowest location number for the initial seed numbers.

func LowestLocationForRange

func LowestLocationForRange(input []string) int

LowestLocationForRange returns the lowest location number for the initial seed numbers ranges.

Types

type Map

type Map struct {
	Entries []MapEntry
}

Map represents a source to destination map.

func NewMap

func NewMap(input []string) *Map

NewMap creates a new map from the given input.

func (*Map) Destination

func (m *Map) Destination(source int) int

Destination returns the destination for the given source.

func (*Map) SortEntries

func (m *Map) SortEntries()

SortEntries sorts the map entries by source start.

type MapEntry

type MapEntry struct {
	SourceStart      int
	DestinationStart int
	Length           int
}

MapEntry represents a map entry.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL