原创 LeetCode 236: Lowest Common Ancestor of a Binary Tree
Lowest Common Ancestor of a Binary Tree Given a binary tree, find the lowest common ancestor (LCA) of two given nod
原创 LeetCode 257: Binary Tree Paths
Binary Tree Paths Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree:
原创 LeetCode 221: Maximal Square
Maximal Square Given a 2D binary matrix filled with 0’s and 1’s, find the largest square containing all 1’s and ret
原创 LeetCode 144: Binary Tree Preorder Traversal
Binary Tree Preorder Traversal Given a binary tree, return the preorder traversal of its nodes’ values. For example
原创 LeetCode 279: Perfect Squares
Perfect Squares Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9,
原创 LeetCode 145: Binary Tree Postorder Traversal
Binary Tree Postorder Traversal Given a binary tree, return the postorder traversal of its nodes’ values. For examp
原创 LeetCode 230: Kth Smallest Element in a BST
Kth Smallest Element in a BST Given a binary search tree, write a function kthSmallest to find the kth smallest ele
原创 LeetCode 235: Lowest Common Ancestor of a Binary Search Tree
Lowest Common Ancestor of a Binary Search Tree Given a binary search tree (BST), find the lowest common ancestor (L
原创 LeetCode 129: Sum Root to Leaf Numbers
Sum Root to Leaf Numbers Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represen
原创 LeetCode 123: Best Time to Buy and Sell Stock III
Best Time to Buy and Sell Stock III Say you have an array for which the ith element is the price of a given stock o
原创 LeetCode 213: House Robber II
House Robber II Note: This is an extension of House Robber. After robbing those houses on that street, the thief ha
原创 LeetCode 120: Triangle
Triangle Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers
原创 LeetCode 264: Ugly Number II
Ugly Number II Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors
原创 LeetCode 124: Binary Tree Maximum Path Sum
Binary Tree Maximum Path Sum Given a binary tree, find the maximum path sum. For this problem, a path is defined as
原创 LeetCode 117: Populating Next Right Pointers in Each Node II
Populating Next Right Pointers in Each Node II Follow up for problem “Populating Next Right Pointers in Each Node”.