题目 Given an integer, write a function to determine if it is a power of two. 解题思路 任何一个2的x次方一定能被int型里最大的2的x次方整除,…
标签:LeetCode Go
[LeetCode By Go 61]108. Convert Sorted Array to Binary Search Tree
题目 Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 解题思路 根据一个…
[LeetCode By Go 90]643. Maximum Average Subarray I
题目 Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximu…
[LeetCode By Go 69]107. Binary Tree Level Order Traversal II
题目 Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left …
[LeetCode By Go 89]367. Valid Perfect Square
题目 Given a positive integer num, write a function which returns True if num is a perfect square else False. No…
[LeetCode By Go 82]198. House Robber
题目 You are a professional robber planning to rob houses along a street. Each house has a certain amount of mon…
[LeetCode By Go 31]453. Minimum Moves to Equal Array Elements
题目 Given a non-empty integer array of size n, find the minimum number of moves required to make all array elem…
[LeetCode By Go 15]292. Nim Game
题目 You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time …
[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 28]283. Move Zeroes
题目 Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative…
[LeetCode By Go 14]521. Longest Uncommon Subsequence I
题目 Given a group of two strings, you need to find the longest uncommon subsequence of this group of two string…
[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…