上一页 1 2 3 4 5 6 7 8 ··· 58 下一页
摘要: https://leetcode.cn/problems/P5rCT8/ /** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * 阅读全文
posted @ 2022-06-28 21:33 知道了呀~ 阅读(67) 评论(0) 推荐(0) 编辑
摘要: 链接:https://www.nowcoder.com/questionTerminal/a2a1d0266629404fba582d416d84b6a0来源:牛客网 把 M 个同样的苹果放在 N 个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法? 注意:5、1、1 和 1、5、1 是同 阅读全文
posted @ 2022-06-28 21:06 知道了呀~ 阅读(134) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/bulb-switcher/ 阅读全文
posted @ 2022-06-28 15:34 知道了呀~ 阅读(67) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/shu-de-zi-jie-gou-lcof/ /** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Ri 阅读全文
posted @ 2022-06-28 10:54 知道了呀~ 阅读(81) 评论(0) 推荐(0) 编辑
摘要: 组合总数 II https://leetcode.cn/problems/combination-sum-ii/ 题解:https://leetcode.cn/problems/combination-sum-ii/solution/dai-ma-sui-xiang-lu-dai-ni-xue-to 阅读全文
posted @ 2022-06-27 16:27 知道了呀~ 阅读(54) 评论(0) 推荐(0) 编辑
摘要: 零钱兑换一:求兑换最少硬币数 https://leetcode.cn/problems/coin-change/ func coinChange(coins []int, amount int) int { dp:=make([]int,amount+1) //dp[i]标识金额为i的时候,需要的最 阅读全文
posted @ 2022-06-27 14:25 知道了呀~ 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 最多包含k个字符类型的子串 注意的是,k标识字符类型,不是次数 func findStr(s string,k int)int{ mxAns:=0 sLen:=len(s) if sLen<=k{ return sLen } mp :=make(map[byte]int) le:=0;ri:=0 / 阅读全文
posted @ 2022-06-26 19:19 知道了呀~ 阅读(191) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/ZL6zAn/ var n,m,ans int var dir =[][]int{{1,0},{0,1},{-1,0},{0,-1}} func checkRange(x,y int) bool{ if x>=0&&x<n&&y>=0&&y< 阅读全文
posted @ 2022-06-26 18:00 知道了呀~ 阅读(47) 评论(0) 推荐(0) 编辑
摘要: func deleteDuplicates( head *ListNode ) *ListNode { new := &ListNode{Next:head} pre,cur := new,head for cur != nil{ for cur.Next != nil && cur.Val == 阅读全文
posted @ 2022-06-26 17:27 知道了呀~ 阅读(51) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/search-in-rotated-sorted-array/ 解题思路: 1、数组旋转之后,分成了两个递增区间,所以第一个步骤就是确定mid位置在那个区间里面 2、在比较mid和target的大小,确定target在区间的左边还是右边 3、 阅读全文
posted @ 2022-06-25 23:00 知道了呀~ 阅读(68) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 58 下一页