Leetcode题解
文章平均质量分 87
忆臻
沉下心来提升自己!!!
展开
-
[Leetcode 283]Move Zeroes
题目描述: Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, given nums = [0, 1, 0, 3, 12], after原创 2017-01-16 17:26:35 · 404 阅读 · 0 评论 -
[Leetcode 455] Assign Cookies
题目描述: Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum size原创 2017-01-29 18:16:11 · 305 阅读 · 0 评论 -
[Leetcode 100] Same Tree
Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the nodes have the same value. 解题思路:题原创 2017-01-21 13:50:01 · 359 阅读 · 0 评论 -
[leetcode 81] Search in Rotated Sorted Array II
题目描述: Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Write a function to determine if a given targe原创 2017-01-20 21:42:39 · 640 阅读 · 0 评论 -
[Leetcode 79] Word Search
题目描述: Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or verti原创 2017-01-20 21:35:35 · 288 阅读 · 0 评论 -
Leetcode 78. Subsets
iven a set of distinct integers, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. For example, If nums = [1,2,3], a solution is: [ [3], [1]原创 2017-01-19 21:23:41 · 284 阅读 · 0 评论 -
Leetcode 189 Rotate Array
题目描述: Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. Note: Try to come up as many solu原创 2017-01-18 15:22:34 · 307 阅读 · 0 评论 -
[Leetcode 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,1 Output: 3 Explanation: The first two digits or the last three digits are con原创 2017-01-16 16:39:45 · 814 阅读 · 0 评论 -
[Leetcode 349]Intersection of Two Arrays
题目描述: Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. Note: Each element in the result must be uni原创 2017-01-17 21:08:21 · 231 阅读 · 0 评论 -
[Leetcode 452] Minimum Number of Arrows to Burst Balloons
题目描述: There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the horizontal diameter. Since it's horizontal原创 2017-01-31 09:20:59 · 338 阅读 · 0 评论