_021_04

package
v0.0.0-...-982d520 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinaryTreeInorderTraversal

func BinaryTreeInorderTraversal(root *TreeNode) []int

func BinaryTreeRightSideView

func BinaryTreeRightSideView(root *TreeNode) []int

func BulbSwitcherIII

func BulbSwitcherIII(light []int) int

func CapacityToShipPackagesWithinDDays

func CapacityToShipPackagesWithinDDays(weights []int, D int) int

func ContiguousSequenceLCCI

func ContiguousSequenceLCCI(nums []int) int

func DecodeWays

func DecodeWays(s string) int

func FindMinimumInRotatedArrayII

func FindMinimumInRotatedArrayII(nums []int) int

func FindMinimumInRotatedSortedArray

func FindMinimumInRotatedSortedArray(nums []int) int

func HouseRobber

func HouseRobber(nums []int) int

func HouseRobberII

func HouseRobberII(nums []int) int

func Implement_strStr

func Implement_strStr(haystack, needle string) int

kms算法

func IntegerBreak

func IntegerBreak(n int) int

func LargestDivisibleSubset

func LargestDivisibleSubset(nums []int) []int

func LargestNumber

func LargestNumber(nums []int) string

func LongestCommonSubsequence

func LongestCommonSubsequence(text1, text2 string) int

最长子字符串类似题目 dp解法

func MajorityElementII

func MajorityElementII(nums []int) []int

TODO: 摩尔投票法

func MaximumLengthOfRepeatedSubarray

func MaximumLengthOfRepeatedSubarray(nums1, nums2 []int) int

func MaximumLengthOfSubarrayWithPositiveProduct

func MaximumLengthOfSubarrayWithPositiveProduct(nums []int) int

func MaximumSwap

func MaximumSwap(num int) int

func MinimumDistanceBetweenBSTNodes

func MinimumDistanceBetweenBSTNodes(root *TreeNode) int

父子节点直接的最小值

func MinimumPathSum

func MinimumPathSum(grid [][]int) int

func MinimumSizeSubarraySum

func MinimumSizeSubarraySum(target int, nums []int) int

func NaryTreeLevelOrderTraversal

func NaryTreeLevelOrderTraversal(root *Node) [][]int

func NumberOfLongestIncreasingSubsequence

func NumberOfLongestIncreasingSubsequence(nums []int) int

func RangeSumOfBST

func RangeSumOfBST(root *TreeNode, low, high int) int

func RangeSumOfBST2

func RangeSumOfBST2(root *TreeNode, low, high int) int

func RemoveDuplicates

func RemoveDuplicates(nums []int) int

func ScrambleString

func ScrambleString(s1, s2 string) bool

递归 超时

func SearchInRotatedSortedArray

func SearchInRotatedSortedArray(nums []int, target int) bool

二分查找

func SingleNumberII

func SingleNumberII(nums []int) int

func SumOfSquareNumbers

func SumOfSquareNumbers(c int) bool

func SumOfSquareNumbers2

func SumOfSquareNumbers2(c int) bool

func SumOfTwoIntegers

func SumOfTwoIntegers(a, b int) int

func UglyNumber

func UglyNumber(n int) bool

func VolumeOfHistogramLCCI

func VolumeOfHistogramLCCI(height []int) int

Types

type ListNode

type ListNode struct {
	Val  int
	Next *ListNode
}

func SwapNodesInPairs

func SwapNodesInPairs(head *ListNode) *ListNode

func SwapNodesInPairs2

func SwapNodesInPairs2(head *ListNode) *ListNode

type Node

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

type TreeNode

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

func IncreasingOrderSearchTree

func IncreasingOrderSearchTree(root *TreeNode) *TreeNode

type Trie

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

func Constructor

func Constructor() Trie

* Initialize your data structure here.

func (*Trie) Insert

func (t *Trie) Insert(word string)

* Inserts a word into the trie.

func (*Trie) Search

func (t *Trie) Search(word string) bool

* Returns if the word is in the trie.

func (*Trie) SearchPrefix

func (t *Trie) SearchPrefix(prefix string) *Trie

func (*Trie) StartsWith

func (t *Trie) StartsWith(prefix string) bool

* Returns if there is any word in the trie that starts with the given prefix.

Jump to

Keyboard shortcuts

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