leetcode
vickyruirui
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
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 path from the root node down to the farthest leaf node.问题说明: 查找从根结点到子结点的最多结点数,可以利用使用迭代实现DFS。/原创 2017-10-18 18:09:07 · 186 阅读 · 0 评论 -
695. Max Area of Island
问题: Given a non-empty 2D array grid of 0’s and 1’s, an island is a group of 1’s (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are sur原创 2017-10-18 15:18:13 · 453 阅读 · 0 评论 -
226. Invert Binary Tree
问题: Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9 to 4 / \ 7 2 / \ / \9 6 3 1问题分析:把二叉树的每个结点的左右两个子结点都进行交换,用递归进行处理。注意当两个子结点中的其中一个为空结点也要进行互换。/** * Defi原创 2017-10-18 18:52:12 · 172 阅读 · 0 评论 -
2. Add Two Numbers
问题: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and retur原创 2017-10-14 10:44:45 · 409 阅读 · 0 评论 -
696. Count Binary Substrings
问题: Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0’s and 1’s, and all the 0’s and all the 1’s in these substrings are grouped consecutively.Substr原创 2017-10-19 14:53:21 · 1138 阅读 · 0 评论 -
389. Find the Difference
问题: Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter at a random position.Find the letter that was added原创 2017-10-20 21:48:55 · 276 阅读 · 0 评论 -
690. Employee Importance
690. Employee Importance**You are given a data structure of employee information, which includes the employee’s unique id, his importance value and his direct subordinates’ id. For example, employee 1原创 2017-10-13 10:52:16 · 267 阅读 · 0 评论 -
463. Island Perimeter
问题描述:You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is complet原创 2017-10-13 13:51:35 · 219 阅读 · 0 评论 -
496. Next Greater Element I
**问题:**You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1’s elements in the corresponding places of nu原创 2017-10-13 17:02:44 · 255 阅读 · 0 评论 -
697. Degree of an Array
问题: Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements.Your task is to find the smallest possible length of a原创 2017-10-31 20:00:39 · 237 阅读 · 0 评论 -
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 elements equal, where a move is incrementing n - 1 elements by 1.问题分析: 对长度为n的数组每一次对n-1个元素加一,问需原创 2017-10-31 20:53:45 · 258 阅读 · 0 评论 -
637. Average of Levels in Binary Tree
问题 Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array.Input: 3 / \ 9 20 / \ 15 7 Output: [3, 14.5, 11] Explanation:原创 2017-10-15 20:45:14 · 258 阅读 · 0 评论 -
485. Max Consecutive Ones
问题: Given a binary array, find the maximum number of consecutive 1s in this array. 问题分析: 需要找到二进制数组中最大的连续1的数量。想到用双循环来解决这个题目,但是犯了一个需要注意的错误。class Solution { public int findMaxConsecutiveOnes(int[原创 2017-10-16 21:00:46 · 196 阅读 · 0 评论 -
513. Find Bottom Left Tree Value
问题: Given a binary tree, find the leftmost value in the last row of the tree.Example 1: Input:2/ \ 1 3Output: 1 Example 2: Input: 1 / \ 2 3 / / \4 5 6 / 7Output: 7原创 2017-11-05 21:30:11 · 497 阅读 · 0 评论 -
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 calling your funct原创 2017-10-26 21:23:38 · 188 阅读 · 0 评论
分享