题目 Given an array of integers, find if the array contains any duplicates. Your function should return true if …
分类:LeetCode
[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…
[LeetCode By Go 97]441. Arranging Coins
题目 You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exac…
[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 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…
[LeetCode By Go 92]501. Find Mode in Binary Search Tree
题目 Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred elemen…