[leetcode] 404 559 563

2018-07-26
阅读 3 分钟
1.9k
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.

[LeetCode] 538 100

2018-07-25
阅读 3 分钟
1.5k
Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all keys greater than the original key in BST.

[LeetCode]653 606

2018-07-24
阅读 3 分钟
1.6k
Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target. Example 1:

070. Climbing Stairs

2018-07-23
阅读 2 分钟
1.2k
Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

746. Min Cost Climbing Stairs

2018-07-21
阅读 1 分钟
2.2k
On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed).

121. Best Time to Buy and Sell Stock

2018-07-21
阅读 1 分钟
1.6k
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 (i.e., buy one and sell one share of the stock), design an algorithm to find the maximum profit. Note that you cannot sell a stock before you buy one.