- 博客(24)
- 收藏
- 关注
原创 LeetCode-230. Kth Smallest Element in a BST
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ≤ k ≤ BST’s total elements.
2017-12-28 08:51:51 139
原创 LeetCode-124. Binary Tree Maximum Path Sum
Given a binary tree, find the maximum path sum.
2017-12-27 19:15:19 126
原创 LeetCode-116. Populating Next Right Pointers in Each Node
Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL.
2017-12-27 08:40:57 119
原创 LeetCode-108. Convert Sorted Array to Binary Search Tree
LeetCode-108. Convert Sorted Array to Binary Search TreeGiven an array where elements are sorted in ascending order, convert it to a height balanced BST.
2017-12-26 19:14:15 155
原创 LeetCode-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.
2017-12-26 08:49:55 126
原创 LeetCode-103. 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 to left for the next level and alternate between).
2017-12-25 14:40:07 113
原创 LeetCode-102. 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).
2017-12-24 10:39:26 145
原创 LeetCode-101. Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
2017-12-23 17:20:53 141
原创 LeetCode-98. Validate Binary Search Tree
Given a binary tree, determine if it is a valid binary search tree (BST).
2017-12-22 08:52:37 125
原创 LeetCode-94. Binary Tree Inorder Traversal
Given a binary tree, return the inorder traversal of its nodes’ values.题目:树的中序遍历递归遍历
2017-12-21 09:46:08 125
原创 LeetCode-581. Shortest Unsorted Continuous Subarray
Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order, too.
2017-12-20 13:44:17 146
原创 LeetCode-560. Subarray Sum Equals K
Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k.
2017-12-19 18:34:06 138
原创 LeetCode-448. Find All Numbers Disappeared in an Array
Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] inclusive that do not appear in this array.
2017-12-18 16:52:38 160
原创 LeetCode-287. Find the Duplicate Number
Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist.
2017-12-16 18:29:30 146
原创 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.
2017-12-14 09:17:31 134
原创 LeetCode-238. Product of Array Except Self
Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i]. Solve it without division and in O(n)
2017-12-13 09:44:47 132
原创 LeetCode-152. Maximum Product Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest product.
2017-12-11 13:34:17 121
原创 LeetCode-128. Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.
2017-12-08 13:32:32 115
原创 LeetCode-121. Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock)
2017-12-07 09:23:51 113
原创 LeetCode-105. Construct Binary Tree from Preorder and Inorder Traversal
Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree.
2017-12-06 13:23:58 145
原创 LeetCode-85. Maximal Rectangle
Given a 2D binary matrix filled with 0’s and 1’s, find the largest rectangle containing only 1’s and return its area.
2017-12-05 13:35:31 150
原创 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 vertically neighboring.
2017-12-03 13:55:19 113
原创 LeetCode-78. Subsets
Given a set of distinct integers, nums, return all possible subsets (the power set). Note: The solution set must not contain duplicate subsets.
2017-12-02 22:32:13 176
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人