晴空An
晴空An
全部文章
分类
图片(1)
题解(14)
归档
标签
去牛客网
登录
/
注册
晴空An的博客
全部文章
(共14篇)
题解 | #二叉树的深度# golang
func TreeDepth( pRoot *TreeNode ) int { // write code here var a,b int if pRoot==nil { return 0 } a = TreeDepth(pRoot.Left...
2021-06-21
0
440
题解 | #二叉搜索树的第k个结点# golang
func KthNode( pRoot *TreeNode , k int ) *TreeNode { // write code here if pRoot == nil || k <= 0 { return nil } stack := N...
2021-06-21
0
353
题解 | #两个链表的第一个公共结点# golang
func FindFirstCommonNode( pHead1 *ListNode , pHead2 *ListNode ) *ListNode { // write code here var answer *ListNode head1 := pHead1 h...
2021-06-21
1
383
题解 | #数组中出现次数超过一半的数字# golang
func MoreThanHalfNum_Solution( numbers []int ) int { // write code here m := make(map[int]int) for i:=0;i<len(numbers);i++ { m...
2021-06-21
0
319
题解 | #第一个只出现一次的字符# golang
func FirstNotRepeatingChar( str string ) int { // write code here m := make(map[byte]int,len(str)) for i:=0;i<len(str);i++ { m[...
2021-06-21
0
285
题解 | #不用加减乘除做加法# golang
func Add( num1 int , num2 int ) int { // write code here for num2!=0 { c:=(num1 & num2) << 1 num1 ^= num2 n...
2021-06-21
0
319
题解 | #数组中重复的数字# golang
func duplicate( numbers []int ) int { // write code here flag := make([]bool,len(numbers)) for i:=0;i<len(numbers);i++ { if fl...
2021-06-21
0
351
题解 | #构建乘积数组# golang
func multiply( A []int ) []int { // write code here length := len(A) answer := make([]int,length) for i:=0;i<length;i++ { ...
2021-06-21
0
301
题解 | #和为S的两个数字# golang
func FindNumbersWithSum( array []int , sum int ) []int { // write code here left :=0 right := len(array)-1 if left==right { ...
2021-06-20
0
372
题解 | #数组中的逆序对# golang
方法一:暴力破解法 func InversePairs( data []int ) int { // write code here var length int = len(data) sum := 0 for i:=0;i<length;i++{ ...
2021-06-20
0
379
首页
上一页
1
2
下一页
末页