题目 Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), …
标签:LeetCode Go
[LeetCode By Go 38]Add to List 122. Best Time to Buy and Sell Stock II
题目 Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm…
[LeetCode By Go 103]1. Two Sum
题目 Given an array of integers, return indices of the two numbers such that they add up to a specific target. Y…
[LeetCode By Go 36]455. Assign Cookies
题目 Assume you are an awesome parent and want to give your children some cookies. But, you should give each chi…
[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 49]13. Roman to Integer
题目 Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999.…
[LeetCode By Go 19]520. Detect Capital
写了这么多题,感觉用go写真方便,可以直接对解题的函数进行测试,测试代码写起来也好方便,多个测试用例很方便就放在一起,简单明了。 题目 Given a word, you need to judge whether th…
[LeetCode By Go 71]231. Power of Two
题目 Given an integer, write a function to determine if it is a power of two. 解题思路 任何一个2的x次方一定能被int型里最大的2的x次方整除,…
[LeetCode By Go 107]507. Perfect Number
题目 We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors ex…
[LeetCode By Go 84]66. Plus One
题目 Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. You may a…
[LeetCode By Go 39]404. Sum of Left Leaves
题目 Find the sum of all left leaves in a given binary tree. Example: 3 / \ 9 20 / \ 15 7 There are two left lea…
[LeetCode By Go 33]530. Minimum Absolute Difference in BST
题目 Given a binary search tree with non-negative values, find the minimum absolute difference between values of…