- 博客(5)
- 收藏
- 关注
原创 reverse-integer
题目描述 Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 click to show spoilers. Have you thought about this? Here are some good questions to ask before coding....
2019-05-25 16:02:22 107
原创 best-time-to-buy-and-sell-stock
Say you have an array for which the i th element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one ...
2019-05-24 20:39:37 141
原创 single-number
题目描述 Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using ex...
2019-05-19 17:18:58 180
原创 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. 思路一:递归 /** * Definition for binary tree...
2019-05-19 17:11:34 126
原创 minimum-depth-of-binary-tree
题目描述 Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. **思路一:**深度遍历(DFS)递归,先判断特殊情况根节点为空(0),...
2019-05-18 22:03:22 73
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人