golang

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 AssignCookies

func AssignCookies(g []int, s []int) (maxNumber int)

func Candy

func Candy(ratings []int) (I int)

func ContainsDuplicate

func ContainsDuplicate(nums []int) bool

func CountPrimes

func CountPrimes(n int) int

func CountPrimes2

func CountPrimes2(n int) int

官方题解:埃氏筛 如果一个数为质数,则这个数所有倍数的数为和数,在数组中置为1 为什么不从2*x开始标记而是从x*x开始标记? 因为2*x开始标记可能会被之前的数重复标记

func EraseOverLapIntervals

func EraseOverLapIntervals(intervals [][]int) int

func FindTheDifference

func FindTheDifference(s, t string) (B byte)

func FindTheDifference2

func FindTheDifference2(s, t string) byte

计数法

func FindTheDifference3

func FindTheDifference3(s, t string) byte

求和

func FindTheDifference4

func FindTheDifference4(s, t string) (B byte)

位运算^异或

func FirstUniqChar

func FirstUniqChar(s string) int

func FlippingMatrix

func FlippingMatrix(A [][]int) int

func GroupAnagrams

func GroupAnagrams(strs []string) (ans [][]string)

func IsIsomorphic

func IsIsomorphic(s, t string) bool

func LastStoneWeight

func LastStoneWeight(stones []int) int

func LemonadeChange

func LemonadeChange(bills []int) (B bool)

func MaxNumber

func MaxNumber(nums1, nums2 []int, k int) []int

func MaxStockProfit

func MaxStockProfit(prices []int, fee int) int

func MaxStockProfit2

func MaxStockProfit2(prices []int, fee int) int

func MinCostClimbingStairs

func MinCostClimbingStairs(cost []int) int

func MineSplit

func MineSplit(s string) (F []int)

默写一遍

func MonotoneIncreasingDigits

func MonotoneIncreasingDigits(N int) (I int)

func OfficialMonotoneIncreasingDigits

func OfficialMonotoneIncreasingDigits(n int) int

官方题解

func PascalTriangle

func PascalTriangle(numRows int) [][]int

func Permute

func Permute(nums []int) (ans [][]int)

func PredictPartyVictory

func PredictPartyVictory(senate string) (S string)

Dota2 Senate leetCode: https://leetcode-cn.com/problems/dota2-senate/

func RemoveDuplicateLetters

func RemoveDuplicateLetters(s string) string

栈 num->每个字母的个数, stack->栈, inStack->是否在栈中

func RotateImage

func RotateImage(matrix [][]int)

临时矩阵

func RotateImage2

func RotateImage2(matrix [][]int)

水平翻转, 主对角线反转

func SearchRange

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

func SplitArray

func SplitArray(nums []int) bool

func SplitIntoFibonacci

func SplitIntoFibonacci(s string) (F []int)

官方题解: 回溯法 + 剪枝函数

func UniquePaths

func UniquePaths(m, n int) int

func WiggleSubsequence

func WiggleSubsequence(nums []int) int

func WiggleSubsequence2

func WiggleSubsequence2(nums []int) (I int)

func WordPattern

func WordPattern(pattern string, s string) bool

func ZigzagLevelOrder

func ZigzagLevelOrder(root *TreeNode) (L [][]int)

数组

func ZigzagLevelOrder2

func ZigzagLevelOrder2(root *TreeNode) (L [][]int)

队列

Types

type TreeNode

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

func BuildTree

func BuildTree(preorder []int, inorder []int) *TreeNode

Jump to

Keyboard shortcuts

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