题目 You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. F…
标签:LeetCode Go
[LeetCode By Go 79]27. Remove Element
题目 Given an array and a value, remove all instances of that value in place and return the new length. Do not a…
[LeetCode By Go 83]101. Symmetric Tree
题目 Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example,…
[LeetCode By Go 37]167. Two Sum II - Input array is sorted
题目 Given an array of integers that is already sorted in ascending order, find two numbers such that they add u…
[LeetCode By Go 45]237. Delete Node in a Linked List
这道题目不能用go语言写答案,所以用了C语言 题目 Write a function to delete a node (except the tail) in a singly linked list, given o…
[LeetCode By Go 81]235. Lowest Common Ancestor of a Binary Search Tree
该题目不能用go语言写,因此使用了C语言(C++忘的更多…)。Go语言写多了,判断语句也忘了加括号,语句末尾忘了加”;”,一条语句的statement也加了”{}̶…
[LeetCode By Go 17]485. Max Consecutive Ones
题目 Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1…
[LeetCode By Go 48]217. Contains Duplicate
题目 Given an array of integers, find if the array contains any duplicates. Your function should return true if …
[LeetCode By Go 43]387. First Unique Character in a String
题目 Given a string, find the first non-repeating character in it and return it’s index. If it doesn’…
[LeetCode By Go 19]520. Detect Capital
写了这么多题,感觉用go写真方便,可以直接对解题的函数进行测试,测试代码写起来也好方便,多个测试用例很方便就放在一起,简单明了。 题目 Given a word, you need to judge whether th…
[LeetCode By Go 99]374. Guess Number Higher or Lower
题目 We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which…
[LeetCode By Go 86]257. Binary Tree Paths
题目 Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \ 2 3…