上一页 1 2 3 4 5 6 7 8 9 ··· 58 下一页
摘要: https://leetcode.cn/problems/merge-intervals/ func merge(intervals [][]int) [][]int { sort.Slice(intervals, func(i, j int) bool { return intervals[i][ 阅读全文
posted @ 2022-06-25 16:11 知道了呀~ 阅读(51) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2022-06-23 20:10 知道了呀~ 阅读(46) 评论(0) 推荐(0) 编辑
摘要: func trailingZeroes(n int) int { ans:=0 for n!=0{ n=n/5 ans=ans+n } return ans } 阅读全文
posted @ 2022-06-22 11:27 知道了呀~ 阅读(55) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/longest-substring-without-repeating-characters/ func lengthOfLongestSubstring(s string) int { mp:=make(map[string]int) le 阅读全文
posted @ 2022-06-22 11:18 知道了呀~ 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 题目连接:https://leetcode.cn/problems/sort-list/ 快排(使用快排容易超时,建议使用归并排序) func main(){ head:=&ListNode{} end:=head aaa:=0 for i:=0;i<6;i++{ if i%2==0{ aaa=i 阅读全文
posted @ 2022-06-21 22:31 知道了呀~ 阅读(104) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/3sum/ func threeSum(nums []int)[][]int{ ans:=make([][]int,0) len:=len(nums) if len<3{ return ans } sort.Ints(nums) for i: 阅读全文
posted @ 2022-06-21 17:59 知道了呀~ 阅读(145) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/two-sum/ func twoSum(nums []int, target int) []int { mp:=make(map[int]int,len(nums)) //某个数字出现的次数 for i := range nums { if 阅读全文
posted @ 2022-06-21 17:58 知道了呀~ 阅读(65) 评论(0) 推荐(0) 编辑
摘要: 常用的设计模式 单例、工厂、观察者、发布订阅、责任链、适配器等 // 单例模式 //单例模式保证系统特定的类或者是结构体对象只有一个实例,是保障系统//实例唯一性的重要手段。 // 饿汉式 //在类创建的时候就已经实例化好了对象,只实例化一次,是线程安全的 //实现: 1、通过init()函数实现 阅读全文
posted @ 2022-06-21 14:36 知道了呀~ 阅读(71) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/trapping-rain-water-ii/ func trapRainWater(heightMap [][]int) int { m, n := len(heightMap), len(heightMap[0]) maxHeight : 阅读全文
posted @ 2022-06-20 15:53 知道了呀~ 阅读(140) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/zheng-ze-biao-da-shi-pi-pei-lcof/ func isMatch(s string, p string) bool { n:=len(s);m:=len(p) vis:=make([][]bool,0,n+1) / 阅读全文
posted @ 2022-06-20 15:15 知道了呀~ 阅读(46) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 58 下一页