国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Golang每日一練(leetDay0049) 二叉樹(shù)專題(9)

這篇具有很好參考價(jià)值的文章主要介紹了Golang每日一練(leetDay0049) 二叉樹(shù)專題(9)。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

Golang每日一練(leetDay0049) 二叉樹(shù)專題(9)

目錄

144. 二叉樹(shù)的前序遍歷 Binary-tree Preorder Traversal????

145. 二叉樹(shù)的前序遍歷 Binary-tree Postorder Traversal????

對(duì)比: 94. 二叉樹(shù)的中序遍歷 Binary-tree Inorder Traversal????

146. LRU緩存 LRU Cache??????

?? 每日一練刷題專欄???

Golang每日一練 專欄

Python每日一練 專欄

C/C++每日一練 專欄

Java每日一練 專欄


二叉樹(shù)專題(9)第146題除外

144. 二叉樹(shù)的前序遍歷 Binary-tree Preorder Traversal

給你二叉樹(shù)的根節(jié)點(diǎn)?root?,返回它節(jié)點(diǎn)值的?前序?遍歷。

示例 1:

Golang每日一練(leetDay0049) 二叉樹(shù)專題(9)

輸入:root = [1,null,2,3]
輸出:[1,2,3]

示例 2:

輸入:root = []
輸出:[]

示例 3:

輸入:root = [1]
輸出:[1]

示例 4:

Golang每日一練(leetDay0049) 二叉樹(shù)專題(9)

輸入:root = [1,2]
輸出:[1,2]

示例 5:

Golang每日一練(leetDay0049) 二叉樹(shù)專題(9)

輸入:root = [1,null,2]
輸出:[1,2]

提示:

  • 樹(shù)中節(jié)點(diǎn)數(shù)目在范圍?[0, 100]?內(nèi)
  • -100 <= Node.val <= 100?

進(jìn)階:遞歸算法很簡(jiǎn)單,你可以通過(guò)迭代算法完成嗎?

公用的示例二叉樹(shù):

    3
   / \
  9  20
    /  \
   15   7

遍歷結(jié)果:

前序遍歷 preorder  = [3,9,20,15,7]
中序遍歷 inorder   =?[9,3,15,20,7]
后序遍歷 postorder = [9,15,7,20,3]

?代碼1: 遞歸

package main

import (
	"fmt"
)

const null = -1 << 31

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

func preorderTraversal(root *TreeNode) []int {
	var res []int
	preorder(root, &res)
	return res
}

func preorder(root *TreeNode, res *[]int) {
	if root == nil {
		return
	}
	*res = append(*res, root.Val)
	preorder(root.Left, res)
	preorder(root.Right, res)
}

func buildTree(nums []int) *TreeNode {
	if len(nums) == 0 {
		return nil
	}
	root := &TreeNode{Val: nums[0]}
	Queue := []*TreeNode{root}
	idx := 1
	for idx < len(nums) {
		node := Queue[0]
		Queue = Queue[1:]
		if nums[idx] != null {
			node.Left = &TreeNode{Val: nums[idx]}
			Queue = append(Queue, node.Left)
		}
		idx++
		if idx < len(nums) && nums[idx] != null {
			node.Right = &TreeNode{Val: nums[idx]}
			Queue = append(Queue, node.Right)
		}
		idx++
	}
	return root
}

func ArrayToString(arr []int) string {
	res := "["
	for i := 0; i < len(arr); i++ {
		res += fmt.Sprint(arr[i])
		if i != len(arr)-1 {
			res += ","
		}
	}
	return res + "]"
}

func main() {
	nums := []int{1, null, 2, 3}
	root := buildTree(nums)
	fmt.Println(ArrayToString(preorderTraversal(root)))
	nums = []int{3, 9, 20, null, null, 15, 7}
	root = buildTree(nums)
	fmt.Println(ArrayToString(preorderTraversal(root)))
}

?代碼2:?迭代

package main

import (
	"fmt"
)

const null = -1 << 31

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

func preorderTraversal(root *TreeNode) []int {
	var res []int
	if root == nil {
		return res
	}
	stack := []*TreeNode{}
	stack = append(stack, root)
	for len(stack) > 0 {
		cur := stack[len(stack)-1]
		stack = stack[:len(stack)-1]
		res = append(res, cur.Val)
		if cur.Right != nil {
			stack = append(stack, cur.Right)
		}
		if cur.Left != nil {
			stack = append(stack, cur.Left)
		}
	}
	return res
}

func buildTree(nums []int) *TreeNode {
	if len(nums) == 0 {
		return nil
	}
	root := &TreeNode{Val: nums[0]}
	Queue := []*TreeNode{root}
	idx := 1
	for idx < len(nums) {
		node := Queue[0]
		Queue = Queue[1:]
		if nums[idx] != null {
			node.Left = &TreeNode{Val: nums[idx]}
			Queue = append(Queue, node.Left)
		}
		idx++
		if idx < len(nums) && nums[idx] != null {
			node.Right = &TreeNode{Val: nums[idx]}
			Queue = append(Queue, node.Right)
		}
		idx++
	}
	return root
}

func ArrayToString(arr []int) string {
	res := "["
	for i := 0; i < len(arr); i++ {
		res += fmt.Sprint(arr[i])
		if i != len(arr)-1 {
			res += ","
		}
	}
	return res + "]"
}

func main() {
	nums := []int{1, null, 2, 3}
	root := buildTree(nums)
	fmt.Println(ArrayToString(preorderTraversal(root)))
	nums = []int{3, 9, 20, null, null, 15, 7}
	root = buildTree(nums)
	fmt.Println(ArrayToString(preorderTraversal(root)))
}

輸出:

[1,2,3]
[3,9,20,15,7]


145. 二叉樹(shù)的后序遍歷 Binary-tree Postorder Traversal

給你一棵二叉樹(shù)的根節(jié)點(diǎn)?root?,返回其節(jié)點(diǎn)值的?后序遍歷?

示例 1:

Golang每日一練(leetDay0049) 二叉樹(shù)專題(9)

輸入:root = [1,null,2,3]
輸出:[3,2,1]

示例 2:

輸入:root = []
輸出:[]

示例 3:

輸入:root = [1]
輸出:[1]

提示:

  • 樹(shù)中節(jié)點(diǎn)的數(shù)目在范圍?[0, 100]?內(nèi)
  • -100 <= Node.val <= 100

進(jìn)階:遞歸算法很簡(jiǎn)單,你可以通過(guò)迭代算法完成嗎?

?代碼1: 遞歸

package main

import (
	"fmt"
)

const null = -1 << 31

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

func postorderTraversal(root *TreeNode) []int {
	var res []int
	postorder(root, &res)
	return res
}

func postorder(root *TreeNode, res *[]int) {
	if root == nil {
		return
	}
	postorder(root.Left, res)
	postorder(root.Right, res)
	*res = append(*res, root.Val)
}

func buildTree(nums []int) *TreeNode {
	if len(nums) == 0 {
		return nil
	}
	root := &TreeNode{Val: nums[0]}
	Queue := []*TreeNode{root}
	idx := 1
	for idx < len(nums) {
		node := Queue[0]
		Queue = Queue[1:]
		if nums[idx] != null {
			node.Left = &TreeNode{Val: nums[idx]}
			Queue = append(Queue, node.Left)
		}
		idx++
		if idx < len(nums) && nums[idx] != null {
			node.Right = &TreeNode{Val: nums[idx]}
			Queue = append(Queue, node.Right)
		}
		idx++
	}
	return root
}

func ArrayToString(arr []int) string {
	res := "["
	for i := 0; i < len(arr); i++ {
		res += fmt.Sprint(arr[i])
		if i != len(arr)-1 {
			res += ","
		}
	}
	return res + "]"
}

func main() {
	nums := []int{1, null, 2, 3}
	root := buildTree(nums)
	fmt.Println(ArrayToString(postorderTraversal(root)))
	nums = []int{3, 9, 20, null, null, 15, 7}
	root = buildTree(nums)
	fmt.Println(ArrayToString(postorderTraversal(root)))
}

?代碼2:?迭代

package main

import (
	"fmt"
)

const null = -1 << 31

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

func postorderTraversal(root *TreeNode) []int {
	var res []int
	if root == nil {
		return res
	}
	stack := []*TreeNode{}
	stack = append(stack, root)
	for len(stack) > 0 {
		cur := stack[len(stack)-1]
		stack = stack[:len(stack)-1]
		res = append([]int{cur.Val}, res...)
		if cur.Left != nil {
			stack = append(stack, cur.Left)
		}
		if cur.Right != nil {
			stack = append(stack, cur.Right)
		}
	}
	return res
}

func buildTree(nums []int) *TreeNode {
	if len(nums) == 0 {
		return nil
	}
	root := &TreeNode{Val: nums[0]}
	Queue := []*TreeNode{root}
	idx := 1
	for idx < len(nums) {
		node := Queue[0]
		Queue = Queue[1:]
		if nums[idx] != null {
			node.Left = &TreeNode{Val: nums[idx]}
			Queue = append(Queue, node.Left)
		}
		idx++
		if idx < len(nums) && nums[idx] != null {
			node.Right = &TreeNode{Val: nums[idx]}
			Queue = append(Queue, node.Right)
		}
		idx++
	}
	return root
}

func ArrayToString(arr []int) string {
	res := "["
	for i := 0; i < len(arr); i++ {
		res += fmt.Sprint(arr[i])
		if i != len(arr)-1 {
			res += ","
		}
	}
	return res + "]"
}

func main() {
	nums := []int{1, null, 2, 3}
	root := buildTree(nums)
	fmt.Println(ArrayToString(postorderTraversal(root)))
	nums = []int{3, 9, 20, null, null, 15, 7}
	root = buildTree(nums)
	fmt.Println(ArrayToString(postorderTraversal(root)))
}

輸出:

[3,2,1]
[9,15,7,20,3]


對(duì)比: 94. 二叉樹(shù)的中序遍歷 Binary-tree Inorder Traversal

給定一個(gè)二叉樹(shù)的根節(jié)點(diǎn)?root?,返回?它的?中序?遍歷?。

示例 1:

Golang每日一練(leetDay0049) 二叉樹(shù)專題(9)

輸入:root = [1,null,2,3]
輸出:[1,3,2]

示例 2:

輸入:root = []
輸出:[]

示例 3:

輸入:root = [1]
輸出:[1]

提示:

  • 樹(shù)中節(jié)點(diǎn)數(shù)目在范圍?[0, 100]?內(nèi)
  • -100 <= Node.val <= 100

進(jìn)階:?遞歸算法很簡(jiǎn)單,你可以通過(guò)迭代算法完成嗎?

代碼1: 遞歸法

package main

import (
	"fmt"
)

const null = -1 << 31

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

func inorderTraversal(root *TreeNode) []int {
	var res []int
	inorder(root, &res)
	return res
}

func inorder(root *TreeNode, res *[]int) {
	if root == nil {
		return
	}
	inorder(root.Left, res)
	*res = append(*res, root.Val)
	inorder(root.Right, res)
}

func buildTree(nums []int) *TreeNode {
	if len(nums) == 0 {
		return nil
	}
	root := &TreeNode{Val: nums[0]}
	Queue := []*TreeNode{root}
	idx := 1
	for idx < len(nums) {
		node := Queue[0]
		Queue = Queue[1:]
		if nums[idx] != null {
			node.Left = &TreeNode{Val: nums[idx]}
			Queue = append(Queue, node.Left)
		}
		idx++
		if idx < len(nums) && nums[idx] != null {
			node.Right = &TreeNode{Val: nums[idx]}
			Queue = append(Queue, node.Right)
		}
		idx++
	}
	return root
}

func ArrayToString(arr []int) string {
	res := "["
	for i := 0; i < len(arr); i++ {
		res += fmt.Sprint(arr[i])
		if i != len(arr)-1 {
			res += ","
		}
	}
	return res + "]"
}

func main() {
	nums := []int{1, null, 2, 3}
	root := buildTree(nums)
	fmt.Println(ArrayToString(inorderTraversal(root)))
	nums = []int{3, 9, 20, null, null, 15, 7}
	root = buildTree(nums)
	fmt.Println(ArrayToString(inorderTraversal(root)))
}

代碼2: 迭代法

package main

import (
	"fmt"
)

const null = -1 << 31

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

func inorderTraversal(root *TreeNode) []int {
	var res []int
	stack := []*TreeNode{}
	cur := root
	for cur != nil || len(stack) > 0 {
		for cur != nil {
			stack = append(stack, cur)
			cur = cur.Left
		}
		cur = stack[len(stack)-1]
		stack = stack[:len(stack)-1]
		res = append(res, cur.Val)
		cur = cur.Right
	}
	return res
}

func buildTree(nums []int) *TreeNode {
	if len(nums) == 0 {
		return nil
	}
	root := &TreeNode{Val: nums[0]}
	Queue := []*TreeNode{root}
	idx := 1
	for idx < len(nums) {
		node := Queue[0]
		Queue = Queue[1:]
		if nums[idx] != null {
			node.Left = &TreeNode{Val: nums[idx]}
			Queue = append(Queue, node.Left)
		}
		idx++
		if idx < len(nums) && nums[idx] != null {
			node.Right = &TreeNode{Val: nums[idx]}
			Queue = append(Queue, node.Right)
		}
		idx++
	}
	return root
}

func ArrayToString(arr []int) string {
	res := "["
	for i := 0; i < len(arr); i++ {
		res += fmt.Sprint(arr[i])
		if i != len(arr)-1 {
			res += ","
		}
	}
	return res + "]"
}

func main() {
	nums := []int{1, null, 2, 3}
	root := buildTree(nums)
	fmt.Println(ArrayToString(inorderTraversal(root)))
	nums = []int{3, 9, 20, null, null, 15, 7}
	root = buildTree(nums)
	fmt.Println(ArrayToString(inorderTraversal(root)))
}

輸出:

[1,3,2]
[9,3,15,20,7]

三種遍歷的遞歸對(duì)比

“根左右、左根右、左右根”

func preorder(root *TreeNode, res *[]int) {
	*res = append(*res, root.Val)
	preorder(root.Left, res)
	preorder(root.Right, res)
}

func inorder(root *TreeNode, res *[]int) {
	inorder(root.Left, res)
	*res = append(*res, root.Val)
	inorder(root.Right, res)
}

func postorder(root *TreeNode, res *[]int) {
	postorder(root.Left, res)
	postorder(root.Right, res)
	*res = append(*res, root.Val)
}

三種遍歷的迭代對(duì)比

注意左、右子節(jié)點(diǎn)的壓棧順序,以及后序結(jié)果中的“追加”實(shí)為“前插”

func preorderTraversal(root *TreeNode) []int {
    var res []int
    if root == nil {
        return res
    }
    stack := []*TreeNode{}
    stack = append(stack, root)
    for len(stack) > 0 {
        cur := stack[len(stack)-1]
        stack = stack[:len(stack)-1]
        res = append(res, cur.Val)
        if cur.Right != nil {
            stack = append(stack, cur.Right)
        }
        if cur.Left != nil {
            stack = append(stack, cur.Left)
        }
    }
    return res
}

func inorderTraversal(root *TreeNode) []int {
    var res []int
    stack := []*TreeNode{}
    cur := root
    for cur != nil || len(stack) > 0 {
        for cur != nil {
            stack = append(stack, cur)
            cur = cur.Left
        }
        cur = stack[len(stack)-1]
        stack = stack[:len(stack)-1]
        res = append(res, cur.Val)
        cur = cur.Right
    }
    return res
}

func postorderTraversal(root *Treecur) []int {
    var res []int
    if root == nil {
        return res
    }
    stack := []*Treecur{}
    stack = append(stack, root)
    for len(stack) > 0 {
        cur := stack[len(stack)-1]
        stack = stack[:len(stack)-1]
        res = append([]int{cur.Val}, res...)
        if cur.Left != nil {
            stack = append(stack, cur.Left)
        }
        if cur.Right != nil {
            stack = append(stack, cur.Right)
        }
    }
    return res
}

146. LRU緩存 LRU Cache

請(qǐng)你設(shè)計(jì)并實(shí)現(xiàn)一個(gè)滿足? LRU (最近最少使用) 緩存 ?約束的數(shù)據(jù)結(jié)構(gòu)。

實(shí)現(xiàn)?LRUCache?類:

  • LRUCache(int capacity)?以?正整數(shù)?作為容量?capacity?初始化 LRU 緩存
  • int get(int key)?如果關(guān)鍵字?key?存在于緩存中,則返回關(guān)鍵字的值,否則返回?-1?。
  • void put(int key, int value)?如果關(guān)鍵字?key?已經(jīng)存在,則變更其數(shù)據(jù)值?value?;如果不存在,則向緩存中插入該組?key-value?。如果插入操作導(dǎo)致關(guān)鍵字?jǐn)?shù)量超過(guò)?capacity?,則應(yīng)該?逐出?最久未使用的關(guān)鍵字。

函數(shù)?get?和?put?必須以?O(1)?的平均時(shí)間復(fù)雜度運(yùn)行。

示例:

輸入
["LRUCache", "put", "put", "get", "put", "get", "put", "get", "get", "get"]
[[2], [1, 1], [2, 2], [1], [3, 3], [2], [4, 4], [1], [3], [4]]
輸出
[null, null, null, 1, null, -1, null, -1, 3, 4]

解釋
LRUCache lRUCache = new LRUCache(2);
lRUCache.put(1, 1); // 緩存是 {1=1}
lRUCache.put(2, 2); // 緩存是 {1=1, 2=2}
lRUCache.get(1);    // 返回 1
lRUCache.put(3, 3); // 該操作會(huì)使得關(guān)鍵字 2 作廢,緩存是 {1=1, 3=3}
lRUCache.get(2);    // 返回 -1 (未找到)
lRUCache.put(4, 4); // 該操作會(huì)使得關(guān)鍵字 1 作廢,緩存是 {4=4, 3=3}
lRUCache.get(1);    // 返回 -1 (未找到)
lRUCache.get(3);    // 返回 3
lRUCache.get(4);    // 返回 4

提示:

  • 1 <= capacity <= 3000
  • 0 <= key <= 10000
  • 0 <= value <= 10^5
  • 最多調(diào)用?2 * 10^5?次?get?和?put

?代碼:

type LRUCache struct {
    capacity int
    cache    map[int]*list.Element
    list     *list.List
}

type pair struct {
    key   int
    value int
}

func Constructor(capacity int) LRUCache {
    return LRUCache{
        capacity: capacity,
        cache:    make(map[int]*list.Element),
        list:     list.New(),
    }
}

func (c *LRUCache) Get(key int) int {
    if elem, ok := c.cache[key]; ok {
        c.list.MoveToFront(elem)
        return elem.Value.(*pair).value
    }
    return -1
}

func (c *LRUCache) Put(key int, value int) {
    if elem, ok := c.cache[key]; ok {
        elem.Value.(*pair).value = value
        c.list.MoveToFront(elem)
    } else {
        if c.list.Len() == c.capacity {
            // remove the least recently used element
            tailElem := c.list.Back()
            delete(c.cache, tailElem.Value.(*pair).key)
            c.list.Remove(tailElem)
        }
        // insert new element to front
        newElem := c.list.PushFront(&pair{key, value})
        c.cache[key] = newElem
    }
}

輸出:


?? 每日一練刷題專欄???

? 持續(xù),努力奮斗做強(qiáng)刷題搬運(yùn)工!

?? 點(diǎn)贊,你的認(rèn)可是我堅(jiān)持的動(dòng)力!?

???收藏,你的青睞是我努力的方向!?

? 評(píng)論,你的意見(jiàn)是我進(jìn)步的財(cái)富!??

??主頁(yè):https://hannyang.blog.csdn.net/?文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-440476.html

Golang每日一練(leetDay0049) 二叉樹(shù)專題(9)

Golang每日一練 專欄

Golang每日一練(leetDay0049) 二叉樹(shù)專題(9)

Python每日一練 專欄

Golang每日一練(leetDay0049) 二叉樹(shù)專題(9)

C/C++每日一練 專欄

Golang每日一練(leetDay0049) 二叉樹(shù)專題(9)

Java每日一練 專欄

到了這里,關(guān)于Golang每日一練(leetDay0049) 二叉樹(shù)專題(9)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • Golang每日一練(leetDay0052)

    Golang每日一練(leetDay0052)

    目錄 153. 尋找旋轉(zhuǎn)排序數(shù)組中的最小值 Find Minimum In Rotated Sorted Array?????? 154. 尋找旋轉(zhuǎn)排序數(shù)組中的最小值 II Find Minimum In Rotated Sorted Array II???????? ?? 每日一練刷題專欄??? Golang每日一練 專欄 Python每日一練 專欄 C/C++每日一練 專欄 Java每日一練 專欄 已知一個(gè)長(zhǎng)度為

    2024年02月02日
    瀏覽(26)
  • Golang每日一練(leetDay0116) 路徑交叉、回文對(duì)

    Golang每日一練(leetDay0116) 路徑交叉、回文對(duì)

    目錄 335. 路徑交叉 Self-crossing???????? 336. 回文對(duì) Palindrome Pairs???????? ?? 每日一練刷題專欄??? Rust每日一練 專欄 Golang每日一練 專欄 Python每日一練 專欄 C/C++每日一練 專欄 Java每日一練 專欄 給你一個(gè)整數(shù)數(shù)組? distance ? 。 從? X-Y ?平面上的點(diǎn)? (0,0) ?開(kāi)始,先向北

    2024年02月12日
    瀏覽(22)
  • Golang每日一練(leetDay0102) 刪除無(wú)效的括號(hào)、累加數(shù)

    Golang每日一練(leetDay0102) 刪除無(wú)效的括號(hào)、累加數(shù)

    目錄 295. 數(shù)據(jù)流的中位數(shù) Find-median-from-data-stream??????? 301. 刪除無(wú)效的括號(hào) Remove Invalid Parentheses??????? 306. 累加數(shù) Additive Number????? ?? 每日一練刷題專欄??? Rust每日一練 專欄 Golang每日一練 專欄 Python每日一練 專欄 C/C++每日一練 專欄 Java每日一練 專欄 中位數(shù) 是有

    2024年02月10日
    瀏覽(27)
  • Golang每日一練(leetDay0098) 生命、Nim、猜數(shù)字游戲

    Golang每日一練(leetDay0098) 生命、Nim、猜數(shù)字游戲

    目錄 289. 生命游戲 Game Of Life?????? 292. Nim 游戲 Nim Game???? 299. 猜數(shù)字游戲 Bulls and Cows?????? ?? 每日一練刷題專欄??? Rust每日一練 專欄 Golang每日一練 專欄 Python每日一練 專欄 C/C++每日一練 專欄 Java每日一練 專欄 生命游戲 ? 是英國(guó)數(shù)學(xué)家約翰·何頓·康威在 1970 年發(fā)

    2024年02月09日
    瀏覽(22)
  • Golang每日一練(leetDay0065) 位1的個(gè)數(shù)、詞頻統(tǒng)計(jì)

    Golang每日一練(leetDay0065) 位1的個(gè)數(shù)、詞頻統(tǒng)計(jì)

    目錄 191. 位1的個(gè)數(shù) Nnumber of 1-bits???? 192. 統(tǒng)計(jì)詞頻 Word Frequency?????? ?? 每日一練刷題專欄??? Golang每日一練 專欄 Python每日一練 專欄 C/C++每日一練 專欄 Java每日一練 專欄 編寫(xiě)一個(gè)函數(shù),輸入是一個(gè)無(wú)符號(hào)整數(shù)(以二進(jìn)制串的形式),返回其二進(jìn)制表達(dá)式中數(shù)字位數(shù)為

    2024年02月06日
    瀏覽(25)
  • Golang每日一練(leetDay0061) 表列序號(hào)、階乘后的零

    Golang每日一練(leetDay0061) 表列序號(hào)、階乘后的零

    目錄 171. Excel 表列序號(hào) Excel Sheet Column Number???? 172. 階乘后的零 Factorial Trailing Zeroes?????? ?? 每日一練刷題專欄??? Golang每日一練 專欄 Python每日一練 專欄 C/C++每日一練 專欄 Java每日一練 專欄 給你一個(gè)字符串? columnTitle ?,表示 Excel 表格中的列名稱。返回? 該列名稱對(duì)

    2024年02月04日
    瀏覽(60)
  • Golang每日一練(leetDay0095) 第一個(gè)錯(cuò)誤的版本、完全平方數(shù)

    Golang每日一練(leetDay0095) 第一個(gè)錯(cuò)誤的版本、完全平方數(shù)

    目錄 278. 第一個(gè)錯(cuò)誤的版本 First Bad Version???? 279. 完全平方數(shù) Perfect Squares?????? ?? 每日一練刷題專欄??? Rust每日一練 專欄 Golang每日一練 專欄 Python每日一練 專欄 C/C++每日一練 專欄 Java每日一練 專欄 你是產(chǎn)品經(jīng)理,目前正在帶領(lǐng)一個(gè)團(tuán)隊(duì)開(kāi)發(fā)新的產(chǎn)品。不幸的是,你

    2024年02月09日
    瀏覽(34)
  • Golang每日一練(leetDay0115) 重新安排行程、遞增的三元子序列

    Golang每日一練(leetDay0115) 重新安排行程、遞增的三元子序列

    目錄 332. 重新安排行程 Reconstruct Itinerary???????? 334. 遞增的三元子序列 Increasing Triplet Subsequence????? ?? 每日一練刷題專欄??? Rust每日一練 專欄 Golang每日一練 專欄 Python每日一練 專欄 C/C++每日一練 專欄 Java每日一練 專欄 給你一份航線列表? tickets ?,其中? tickets[i]

    2024年02月16日
    瀏覽(21)
  • Golang每日一練(leetDay0118) 扁平化嵌套列表迭代器、整數(shù)拆分

    Golang每日一練(leetDay0118) 扁平化嵌套列表迭代器、整數(shù)拆分

    目錄 341. 扁平化嵌套列表迭代器 Flatten Nested List Iterator?????? 343. 整數(shù)拆分 Integer Break?????? ?? 每日一練刷題專欄??? Rust每日一練 專欄 Golang每日一練 專欄 Python每日一練 專欄 C/C++每日一練 專欄 Java每日一練 專欄 給你一個(gè)嵌套的整數(shù)列表? nestedList ?。每個(gè)元素要么是

    2024年02月16日
    瀏覽(54)
  • Golang每日一練(leetDay0075) 打家劫舍II、最短回文串

    Golang每日一練(leetDay0075) 打家劫舍II、最短回文串

    目錄 213. 打家劫舍 II House Robber ii?????? 214. 最短回文串 Shortest Palindrome???????? ?? 每日一練刷題專欄??? Rust每日一練 專欄 Golang每日一練 專欄 Python每日一練 專欄 C/C++每日一練 專欄 Java每日一練 專欄 你是一個(gè)專業(yè)的小偷,計(jì)劃偷竊沿街的房屋,每間房?jī)?nèi)都藏有一定的

    2024年02月06日
    瀏覽(29)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包