utils

package
v0.0.0-...-6ad7fa7 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Log = golog.New("leetcode", golog.OptLevelFromEnv())

Functions

func CopySlice

func CopySlice[T comparable](s []T) []T

func HasDuplicate

func HasDuplicate[T comparable](s []T) bool

func SameList

func SameList(a, b *ListNode) bool

func SameTree

func SameTree(a, b *TreeNode) bool

func SliceContain

func SliceContain[T comparable](s []T, v T) bool

Types

type IntValue

type IntValue struct {
	// contains filtered or unexported fields
}

type ListNode

type ListNode struct {
	Val  int
	Next *ListNode
}

func MakeCycleListNode

func MakeCycleListNode(nums ...int) *ListNode

func MakeListNode

func MakeListNode(nums ...int) *ListNode

func (*ListNode) Get

func (n *ListNode) Get(v int) *ListNode

func (*ListNode) String

func (n *ListNode) String() string

type NTreeNode

type NTreeNode struct {
	Val      int
	Children []*NTreeNode
}

func MakeNaryTree

func MakeNaryTree(v ...interface{}) *NTreeNode

func (*NTreeNode) Preorder

func (n *NTreeNode) Preorder() []int

type NestedInteger

type NestedInteger struct {
	// contains filtered or unexported fields
}

func MakeNestedInteger

func MakeNestedInteger(v int) *NestedInteger

func MakeNestedIntegerList

func MakeNestedIntegerList(v ...int) *NestedInteger

func (*NestedInteger) Add

func (this *NestedInteger) Add(elem *NestedInteger) *NestedInteger

func (NestedInteger) GetInteger

func (this NestedInteger) GetInteger() int

func (NestedInteger) GetList

func (this NestedInteger) GetList() []*NestedInteger

func (NestedInteger) IsInteger

func (this NestedInteger) IsInteger() bool

func (*NestedInteger) SetInteger

func (this *NestedInteger) SetInteger(value int)

type TestCase

type TestCase[I, E any] struct {
	// contains filtered or unexported fields
}

func NewTestCase

func NewTestCase[I, E any](t *testing.T, fn func(I) E) TestCase[I, E]

func (*TestCase[I, E]) ConfigSetCheckFunc

func (tc *TestCase[I, E]) ConfigSetCheckFunc(fn func(a, b E) bool)

func (*TestCase[I, E]) ConfigSetOutputInAnyOrder

func (tc *TestCase[I, E]) ConfigSetOutputInAnyOrder()

func (*TestCase[I, E]) GetExpect

func (tc *TestCase[I, E]) GetExpect() E

func (*TestCase[I, E]) GetInput

func (tc *TestCase[I, E]) GetInput() I

func (*TestCase[I, E]) RunTest

func (tc *TestCase[I, E]) RunTest()

func (*TestCase[I, E]) SetAndRun

func (tc *TestCase[I, E]) SetAndRun(input I, expect E)

func (*TestCase[I, E]) SetExpect

func (tc *TestCase[I, E]) SetExpect(v E)

func (*TestCase[I, E]) SetInput

func (tc *TestCase[I, E]) SetInput(v I)

type TreeNode

type TreeNode struct {
	Val   int
	Left  *TreeNode
	Right *TreeNode
}

func MakeBinaryTree

func MakeBinaryTree(v ...interface{}) *TreeNode

func (*TreeNode) Get

func (n *TreeNode) Get(v int) *TreeNode

func (*TreeNode) Graph

func (n *TreeNode) Graph(name string)

func (*TreeNode) Inorder

func (n *TreeNode) Inorder() []int

func (*TreeNode) Postorder

func (n *TreeNode) Postorder() []int

func (*TreeNode) Preorder

func (n *TreeNode) Preorder() []int

Jump to

Keyboard shortcuts

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