_396_design_underground_system

package
v0.0.0-...-4cd11fd Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Station string
	Time    int
}

type UndergroundSystem

type UndergroundSystem struct {
	Stats   map[[2]string][2]int // key: [startStation, endStation], value: [timeSpent, trips]
	Enroute map[int]Entry        // key: id, value: {startStation, startTime}
}

func Constructor

func Constructor() UndergroundSystem

func (*UndergroundSystem) CheckIn

func (us *UndergroundSystem) CheckIn(id int, stationName string, t int)

func (*UndergroundSystem) CheckOut

func (us *UndergroundSystem) CheckOut(id int, stationName string, t int)

func (*UndergroundSystem) GetAverageTime

func (us *UndergroundSystem) GetAverageTime(startStation string, endStation string) float64

Jump to

Keyboard shortcuts

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