题目 Say you have an array for which the ith element is the price of a given stock on day i. If you were only pe…
分类:LeetCode
[LeetCode By Go 32]349. Intersection of Two Arrays
题目 Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums…
[LeetCode By Go 50]206. Reverse Linked List
题目 Reverse a singly linked list. 解题思路 头插法 代码 /** * Definition for singly-linked list. * type ListNode struct {…
[LeetCode By Go 4]476. Number Complement
题目描述 Given a positive integer, output its complement number. The complement strategy is to flip the bits of it…
[LeetCode By Go 73]437. Path Sum III
题目 You are given a binary tree in which each node contains an integer value. Find the number of paths that sum…
[LeetCode By Go 104]38. Count and Say
题目 The count-and-say sequence is the sequence of integers with the first five terms as following: 1 11 21 1211…
[LeetCode By Go 53]628. Maximum Product of Three Numbers
题目 Given an integer array, find three numbers whose product is maximum and output the maximum product. Example…
[LeetCode By Go 57]268. Missing Number
题目 Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing f…
[LeetCode By Go 29]492. Construct the Rectangle
马上写了30道题目了,使用golang写起题目来代码简洁明了,还可以非常方便的写测试用例,加上Goland可以进行调试,有如神助。 但无论如何,写了测试就会依赖测试判断对错,用了debug就会依赖debug来寻找出错的地…
[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 40]599. Minimum Index Sum of Two Lists
题目 Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restau…
[LeetCode By Go 18]104. Maximum Depth of Binary Tree
题目 Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest pat…