遍历
文章平均质量分 74
jmspan
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
LeetCode 280. Wiggle Sort(摇摆排序)
原题网址:https://leetcode.com/problems/wiggle-sort/ Given an unsorted array nums, reorder it in-place such that nums[0] = nums[2] . For example, given nums = [3, 5, 2, 1, 6, 4], one possible ans原创 2016-04-14 07:27:02 · 975 阅读 · 0 评论 -
LeetCode 59. Spiral Matrix II(螺旋矩阵)
原题网址:https://leetcode.com/problems/spiral-matrix-ii/ Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example, Given n = 3, You should retu原创 2016-05-21 07:50:26 · 449 阅读 · 0 评论 -
LeetCode 98. Validate Binary Search Tree(校验二叉搜索树)
原题网址:https://leetcode.com/problems/validate-binary-search-tree/ Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtre原创 2016-05-23 00:39:15 · 553 阅读 · 0 评论 -
LeetCode 101. Symmetric Tree(对称的树)
原题网址:https://leetcode.com/problems/symmetric-tree/ Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric:原创 2016-05-23 03:22:34 · 809 阅读 · 0 评论 -
LeetCode 102. Binary Tree Level Order Traversal(二叉树分层遍历)
原题网址:https://leetcode.com/problems/binary-tree-level-order-traversal/ Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For原创 2016-05-23 03:55:58 · 585 阅读 · 0 评论 -
LeetCode 103. Binary Tree Zigzag Level Order Traversal(二叉树之字形遍历)
原题网址:https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/ Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right原创 2016-05-23 03:58:09 · 1435 阅读 · 0 评论 -
LeetCode 145. Binary Tree Postorder Traversal(二叉树后序遍历)
原题网址:https://leetcode.com/problems/binary-tree-postorder-traversal/ Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1原创 2016-05-26 01:31:28 · 574 阅读 · 0 评论 -
LeetCode 94. Binary Tree Inorder Traversal(二叉树的中序遍历)
原题网址:https://leetcode.com/problems/binary-tree-inorder-traversal/ Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1原创 2016-05-23 00:35:01 · 1064 阅读 · 0 评论 -
LeetCode 332. Reconstruct Itinerary(重构行程)
原题网址:https://leetcode.com/problems/reconstruct-itinerary/ Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order.原创 2016-04-29 08:06:51 · 1745 阅读 · 0 评论 -
LeetCode 99. Recover Binary Search Tree(修复二叉搜索树)
原题网址:https://leetcode.com/problems/recover-binary-search-tree/ Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Note: A sol原创 2016-05-23 00:39:29 · 670 阅读 · 0 评论 -
LeetCode 54. Spiral Matrix(螺旋矩阵)
原题网址:https://leetcode.com/problems/spiral-matrix/ Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example, Given the following mat原创 2016-05-21 06:56:42 · 761 阅读 · 0 评论 -
LeetCode 48. Rotate Image(旋转)
原题网址:https://leetcode.com/problems/rotate-image/ You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up: Could you do this in-place?原创 2016-05-21 05:34:52 · 449 阅读 · 0 评论 -
LeetCode 6. ZigZag Conversion(之字形)
原题网址:https://leetcode.com/problems/zigzag-conversion/ The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a原创 2016-05-19 03:47:47 · 505 阅读 · 0 评论 -
LeetCode 281. Zigzag Iterator(之字形迭代器)
原题网址:https://leetcode.com/problems/zigzag-iterator/ Given two 1d vectors, implement an iterator to return their elements alternately. For example, given two 1d vectors: v1 = [1, 2] v2 = [3, 4原创 2016-04-14 07:40:12 · 1058 阅读 · 0 评论 -
LeetCode 105. Construct Binary Tree from Preorder and Inorder Traversal(从前序遍历和中序遍历构造二叉树)
原题网址:https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/ Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume t原创 2016-05-24 00:12:34 · 499 阅读 · 0 评论 -
LeetCode 106. Construct Binary Tree from Inorder and Postorder Traversal(根据中序遍历和后序遍历构造二叉树)
原题网址:https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/ Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume原创 2016-05-24 00:12:37 · 506 阅读 · 0 评论 -
LeetCode 107. Binary Tree Level Order Traversal II(二叉树分层遍历)
原题网址:https://leetcode.com/problems/binary-tree-level-order-traversal-ii/ Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by le原创 2016-05-24 00:12:44 · 498 阅读 · 0 评论 -
LeetCode 112. Path Sum(路径和)
原题网址:https://leetcode.com/problems/path-sum/ Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.原创 2016-05-24 00:18:59 · 534 阅读 · 0 评论 -
LeetCode 114. Flatten Binary Tree to Linked List(摊平二叉树)
原题网址:https://leetcode.com/problems/flatten-binary-tree-to-linked-list/ Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / \ 2 5原创 2016-05-24 00:19:26 · 566 阅读 · 0 评论 -
LeetCode 298. Binary Tree Longest Consecutive Sequence(二叉树最长连续序列)
原题网址:https://leetcode.com/problems/binary-tree-longest-consecutive-sequence/ Given a binary tree, find the length of the longest consecutive sequence path. The path refers to any sequence原创 2016-04-17 00:08:30 · 1364 阅读 · 0 评论 -
LeetCode 314. Binary Tree Vertical Order Traversal(二叉树垂直遍历)
原题网址:https://leetcode.com/problems/binary-tree-vertical-order-traversal/ Given a binary tree, return the vertical order traversal of its nodes' values. (ie, from top to bottom, column by column).原创 2016-04-22 02:19:07 · 6117 阅读 · 0 评论 -
LeetCode 337. House Robber III(小偷游戏)
原题网址:https://leetcode.com/problems/house-robber-iii/ The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root,原创 2016-04-30 06:12:14 · 1064 阅读 · 0 评论 -
LeetCode 331. Verify Preorder Serialization of a Binary Tree(校验二叉树的前序遍历序列化)
原题网址:https://leetcode.com/problems/verify-preorder-serialization-of-a-binary-tree/ One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record t原创 2016-04-28 07:36:08 · 1019 阅读 · 0 评论
分享