Documentation ¶
Index ¶
- Constants
- func Abs(num int) int
- func Manhattan(x1 int, y1 int, x2 int, y2 int) int
- func Max[T cmp.Ordered](nums ...T) T
- func Min[T cmp.Ordered](nums ...T) T
- func Sum(nums ...int) int
- type BinaryMatrix
- type Cache
- type FoodItem
- type FoodItemsPQ
- type FoodRatings
- type IntHeap
- type ListNode
- type Logger
- type MovingAverage
- type MyQueue
- type NumArray
- type PairNode
- type ParkingSystem
- type Queue
- type Queueable
- type RandomizedSet
- type SeatManager
- type Set
- type Stack
- type Stackable
- type SticksPQ
- type TreeNode
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func Max ¶
Max returns maximum of `nums` of type `T` and have more friendly interface then build-in `max()`. Panics if `nums` have zero elements.
Types ¶
type FoodItemsPQ ¶
type FoodItemsPQ struct {
// contains filtered or unexported fields
}
func (*FoodItemsPQ) Len ¶
func (pq *FoodItemsPQ) Len() int
func (*FoodItemsPQ) Less ¶
func (pq *FoodItemsPQ) Less(i, j int) bool
func (*FoodItemsPQ) Pop ¶
func (pq *FoodItemsPQ) Pop() interface{}
func (*FoodItemsPQ) Push ¶
func (pq *FoodItemsPQ) Push(x interface{})
func (*FoodItemsPQ) Swap ¶
func (pq *FoodItemsPQ) Swap(i, j int)
type FoodRatings ¶
type FoodRatings struct {
// contains filtered or unexported fields
}
func FoodRatingsConstructor ¶
func FoodRatingsConstructor(foods []string, cuisines []string, ratings []int) FoodRatings
func (*FoodRatings) ChangeRating ¶
func (fr *FoodRatings) ChangeRating(food string, newRating int)
func (*FoodRatings) HighestRated ¶
func (fr *FoodRatings) HighestRated(cuisine string) string
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func LoggerConstructor ¶
func LoggerConstructor() Logger
type MovingAverage ¶
type MovingAverage struct {
// contains filtered or unexported fields
}
func MovingAverageConstructor ¶
func MovingAverageConstructor(size int) MovingAverage
func (*MovingAverage) Next ¶
func (ma *MovingAverage) Next(next int) float64
type MyQueue ¶
type MyQueue struct {
// contains filtered or unexported fields
}
func MyQueueConstructor ¶
func MyQueueConstructor() MyQueue
type NumArray ¶
type NumArray struct {
// contains filtered or unexported fields
}
func NumArrayConstructor ¶
type ParkingSystem ¶
type ParkingSystem struct {
// contains filtered or unexported fields
}
func ParkingSystemConstructor ¶
func ParkingSystemConstructor(big int, medium int, small int) ParkingSystem
func (*ParkingSystem) AddCar ¶
func (ps *ParkingSystem) AddCar(carType int) bool
type Queue ¶
type RandomizedSet ¶
type RandomizedSet struct {
// contains filtered or unexported fields
}
func RandomizedSetConstructor ¶
func RandomizedSetConstructor() RandomizedSet
func (*RandomizedSet) GetRandom ¶
func (rs *RandomizedSet) GetRandom() int
func (*RandomizedSet) Insert ¶
func (rs *RandomizedSet) Insert(val int) bool
func (*RandomizedSet) Remove ¶
func (rs *RandomizedSet) Remove(val int) bool
type SeatManager ¶
type SeatManager struct {
// contains filtered or unexported fields
}
func SeatManagerConstructor ¶
func SeatManagerConstructor(n int) SeatManager
func (*SeatManager) Reserve ¶
func (sm *SeatManager) Reserve() int
func (*SeatManager) Unreserve ¶
func (sm *SeatManager) Unreserve(seatNumber int)
type Set ¶
type Set[T comparable] interface { Add(val T) Del(val T) Size() int Populate(vals ...T) Contains(val T) bool Values() []T }
func NewSet ¶
func NewSet[T comparable]() Set[T]
type Stack ¶
Source Files ¶
- adddigits.go
- addtwonumbers.go
- amountoftime.go
- arraysign.go
- arraystringsareequal.go
- assignbikes_1.go
- assignbikes_2.go
- averageofsubtree.go
- backspacecompare.go
- bagoftokensscore.go
- binarytreepaths.go
- buildarray.go
- buychoco.go
- cache.go
- calculatetime.go
- canattendmeetings.go
- canpermutepalindrome.go
- checkarithmeticsubarrays.go
- cherrypickup.go
- climbstairs.go
- closestrings.go
- commonchars.go
- compareversion.go
- connectsticks.go
- const.go
- containsnearbyduplicate.go
- converttotitle.go
- countcharacters.go
- counthomogenous.go
- countnicepairs.go
- countnodes.go
- countpairs.go
- countpalindromicsubsequence.go
- countstudents.go
- countsubstrings.go
- customsortstring.go
- dailytemperatures.go
- daysbetweendates.go
- decode.go
- decrypt.go
- deletenode.go
- destcity.go
- diameterofbinarytree.go
- distinctintegers.go
- dividearray.go
- doubleit.go
- eliminatemaximum.go
- equalsubstring.go
- equaltodescendants.go
- evalrpn.go
- evaluatetree.go
- evenoddbit.go
- exist.go
- fib.go
- findarray.go
- findbottomleftvalue.go
- findcontentchildren.go
- finddiagonalorder.go
- finddifferentbinarystring.go
- finderrornums.go
- findjudge.go
- findleastnumofuniqueints.go
- findmatrix.go
- findmaxaverage.go
- findmaxconsecutiveones_1.go
- findmaxconsecutiveones_2.go
- findmaxk.go
- findmaxlength.go
- findmediansortedarrays.go
- findmiddleindex.go
- findminarrowshots.go
- findmindifference.go
- findmissingranges.go
- findmode.go
- findnumbers.go
- findpaths.go
- findrelativeranks.go
- findspecialinteger.go
- findwinners.go
- firstpalindrome.go
- firstuniqchar.go
- foodratings.go
- frequenciesofelements.go
- frequencysort.go
- furthestbuilding.go
- gameresult.go
- garbagecollection.go
- generate.go
- generatepossiblenextmoves.go
- getaverages.go
- getcommon.go
- getintersectionnode.go
- getlastmoment.go
- getmaximumgold.go
- getrow.go
- getsumabsolutedifferences.go
- getwinner.go
- groupanagrams.go
- halvesarealike.go
- hammingweight.go
- hascycle.go
- heightchecker.go
- imagesmoother.go
- inordertraversal.go
- insert.go
- intersection.go
- inverttree.go
- isanagram.go
- isbalanced.go
- iscircularsentence.go
- isevenoddtree.go
- ishappy.go
- isisomorphic.go
- ispalindrome_1.go
- ispalindrome_2.go
- ispathcrossing.go
- isperfectsquare.go
- ispoweroffour.go
- ispoweroftwo.go
- isprefixstring.go
- isreachableattime.go
- issametree.go
- isstrobogrammatic.go
- issubtree.go
- isvalidpalindrome.go
- knightdialer.go
- kthgrammar.go
- kweakestrows.go
- largestaltitude.go
- largestdivisiblesubset.go
- largestgoodinteger.go
- largestoddnumber.go
- largestperimeter.go
- leafsimilar.go
- leastinterval.go
- leftmostcolumnwithone.go
- lengthoflastword.go
- lengthoflis.go
- lengthoflongestsubstring.go
- lengthoflongestsubstringkdistinct.go
- lengthoflongestsubstringtwodistinct.go
- logger.go
- longestcommonsubsequence.go
- longestones.go
- majorityelement.go
- makeequal.go
- math.go
- maxancestordiff.go
- maxcoins.go
- maxdepth.go
- maxdistance.go
- maxfrequency.go
- maxfrequencyelements.go
- maximumaveragesubtree.go
- maximumelementafterdecrementingandrearranging.go
- maximumhappinesssum.go
- maximumoddbinarynumber.go
- maxlength.go
- maxlengthbetweenequalcharacters.go
- maxproduct.go
- maxproductdifference.go
- maxscore.go
- maxsubarray.go
- maxsubarraylength.go
- maxvowels.go
- maxwidthofverticalarea.go
- mergeinbetween.go
- middlenode.go
- mincost_1.go
- mincost_2.go
- mincostclimbingstairs.go
- mindistance.go
- minfallingpathsum.go
- minimumlength.go
- minimumoperations.go
- minimumrounds.go
- minmeetingrooms.go
- minoperations_1.go
- minoperations_2.go
- minpairsum.go
- minstartvalue.go
- minsteps.go
- minsubarraylen.go
- mintimetovisitallpoints.go
- mintotaldistance.go
- minwindow.go
- missingnumber.go
- movezeroes.go
- movingaverage.go
- myqueue.go
- mysqrt.go
- numarray.go
- numberofbeams.go
- numberofmatches.go
- numrescueboats.go
- numrollstotarget.go
- numspecial.go
- numsquares.go
- numsubarrayproductlessthank.go
- numsubarrayswithsum.go
- numways_1.go
- numways_2.go
- onesminuszeros.go
- parkingsystem.go
- pivotindex.go
- pivotinteger.go
- poorpigs.go
- postordertraversal.go
- prefixesdivby5.go
- preordertraversal.go
- productexceptself.go
- pseudopalindromicpaths.go
- queue.go
- randomizedset.go
- rangebitwiseand.go
- rangesumbst.go
- rearrangearray.go
- reductionoperations.go
- removedigit.go
- removeinterval.go
- removeleafnodes.go
- removenodes.go
- removenthfromend.go
- removevowels.go
- removezerosumsublists.go
- reorderlist.go
- restorearray.go
- reverse.go
- reverselist.go
- reverseonlyletters.go
- reverseprefix.go
- reversestring.go
- reversewords.go
- rob.go
- runningsum.go
- search.go
- searchinsert.go
- seatmanager.go
- sequentialdigits.go
- set.go
- shortestdistance.go
- shuffle.go
- solution.go
- sortarraybyparity.go
- sortbybits.go
- sortedsquares.go
- sortvowels.go
- stack.go
- structs.go
- sumofdigits.go
- sumofleftleaves.go
- sumsubarraymins.go
- titletonumber.go
- tohex.go
- totalmoney.go
- transformarray.go
- transpose.go
- tree2str.go
- tribonacci.go
- twooutofthree.go
- twosum_1.go
- twosumlessthank.go
- uniqueoccurrences.go
- uniquepaths.go
- validatebinarytreenodes.go
- validpalindrome.go
- validwordabbreviation.go
Click to show internal directories.
Click to hide internal directories.