摘要: bit数组构建一个非负整数Set集合 实现了下面这些方法: func (s *IntSet) Has(x int) bool //不断集合中是否存在元素x func (s *IntSet) Add(x int) // 添加元素 func (*IntSet) Len() int // return t 阅读全文
posted @ 2025-08-21 16:53 dwhere 阅读(9) 评论(0) 推荐(0)
摘要: Map构建有向图 var graph = make(map[string]map[string]bool) func addEdge(from, to string) { edges := graph[from] if edges == nil { edges = make(map[string]b 阅读全文
posted @ 2025-08-18 16:39 dwhere 阅读(7) 评论(0) 推荐(0)
摘要: 二叉树来实现一个插入排序 go 递归 package main import "fmt" type tree struct { value int left, right *tree } func treeSort(values []int) []int { var t *tree for _, v 阅读全文
posted @ 2025-07-17 14:34 dwhere 阅读(4) 评论(0) 推荐(0)
摘要: 给你二叉树的根节点 `root` ,返回其节点值的 **层序遍历** 阅读全文
posted @ 2024-12-05 15:58 dwhere 阅读(16) 评论(0) 推荐(0)
摘要: 请你将两个数相加,并以相同形式返回一个表示和的链表。 阅读全文
posted @ 2024-11-27 16:16 dwhere 阅读(13) 评论(0) 推荐(0)
摘要: 合并两个有序链表 阅读全文
posted @ 2024-11-27 15:44 dwhere 阅读(45) 评论(0) 推荐(0)
摘要: 判断该链表是否为回文链表 阅读全文
posted @ 2024-11-26 17:32 dwhere 阅读(30) 评论(0) 推荐(0)
摘要: 两两交换链表中的节点 阅读全文
posted @ 2024-11-25 21:10 dwhere 阅读(30) 评论(0) 推荐(0)
摘要: 删除链表的倒数第 N 个结点 阅读全文
posted @ 2024-11-25 17:49 dwhere 阅读(15) 评论(0) 推荐(0)
摘要: 给定一个未排序的整数数组 nums ,找出数字连续的最长序列(不要求序列元素在原数组中连续)的长度。 阅读全文
posted @ 2024-11-09 16:15 dwhere 阅读(31) 评论(0) 推荐(1)