leetcode_cn

package
v0.0.0-...-077e18b Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFourNumbers

func AddFourNumbers(A [3]int, B [3]int, C [3]int, D [3]int) (count int)

AddFourNumbers 该方法的时间复杂度为 O(n^2)

func AddFourNumbers1

func AddFourNumbers1(A [3]int, B [3]int, C [3]int, D [3]int) (length int)

AddFourNumbers1 该方法虽然能测试通过,但是时间复杂度未 O(n^4), 不可取

func BinarySearch

func BinarySearch(a []int, n int) int

func BinarySearch1

func BinarySearch1(a []int, n int) int

在列表a中查找数字n, 找到返回其下标, 找不到返回-1

func BinarySearch2

func BinarySearch2(a []int, n int) int

func ByteSliceValueEqual

func ByteSliceValueEqual(a, b []byte) bool

func Reverse

func Reverse(s string) string

func SliceValueEqual

func SliceValueEqual(a, b []int) bool

SliceValueEqual 两个切片中的值是否相同

Types

type ListNode

type ListNode struct {
	Val  int
	Next *ListNode
}

type MyLinkedList

type MyLinkedList struct {
	Head *ListNode `json:"header"`
	Tail *ListNode `json:"tail"`
	Lens int       `json:"lens"`
}

func Constructor

func Constructor() MyLinkedList

func (*MyLinkedList) AddAtHead

func (this *MyLinkedList) AddAtHead(val int)

func (*MyLinkedList) AddAtIndex

func (this *MyLinkedList) AddAtIndex(index int, val int)

func (*MyLinkedList) AddAtTail

func (this *MyLinkedList) AddAtTail(val int)

func (*MyLinkedList) DeleteAtIndex

func (this *MyLinkedList) DeleteAtIndex(index int)

func (*MyLinkedList) Get

func (this *MyLinkedList) Get(index int) int

func (*MyLinkedList) PrintMyLinkedList

func (this *MyLinkedList) PrintMyLinkedList()

Jump to

Keyboard shortcuts

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