Golang刷题Leetcode 81. Search in Rotated Sorted Array II

搜索某个元素思路依然可以用二分查找,注意到每个点的时候,都要判断方向codefuncsearchbool{l。

Golang 刷题 Leetcode 71. Simplify Path

FieldsFuncbool{ifs==’/'{returntrue}returnfalse})fori:=0;i

Golang刷题Leetcode 100. Same Tree

最常见的解法就是递归codetypeTreeNodestruct{ValintLeft*TreeNodeRight*TreeNode}funcisSameTreebool{ifp==nil&&q==nil{returntrue}if||{returnfalse}ifp.Val!

Golang刷题Leetcode 75. Sort Colors

题目:SortColorsGivenanarraywithnobjectscoloredred,whiteorblue,sortthemin-placesothatobjectsofthesamecolorareadjacent,withthecolorsintheorderre

Golang刷题找工作 Leetcode-2

Addthetwonumbersandreturnitasalinkedlist.给两个非空的链表代表两个非负整数,返回他们相加之后的逆序结果例如输入。

Golang刷题 Leetcode 83. Remove Duplicates from Sorted List

deleteallduplicatessuchthateachelementappearonlyonce.给一个排好序的链表,删除其中重复的元素思路简单的循环。

Golang刷题Leetcode 18. 4Sum

]int{0,0,0}fori:=0;i0&&nums[i-1]==nums[i]{continue}forj:=i+1;jtarget&&nums[j]>0{//后面不可能

Golang刷题Leetcode 88. Merge Sorted Array

题目:MergeSortedArrayGiventwosortedintegerarraysnums1andnums2,mergenums2intonums1asonesortedarray。

Golang刷题Leetcode 136. Single Number

题目:SingleNumberGivenanon-emptyarrayofintegers,everyelementappearstwiceexceptforone.Findthatsingleone.给一个非空数组,除了一个数字,其他数字都出现两次,找到只出现一次的数字思路一个