![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode刷题
Matthewly
这个作者很懒,什么都没留下…
展开
-
reverse-polish-notation
evaluate-reverse-polish-notation 要求:Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another expression. 思路:逆波兰原创 2016-09-14 10:58:56 · 322 阅读 · 0 评论 -
查找二叉树的最小深度
题目: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. 分析原创 2016-09-14 09:28:57 · 794 阅读 · 0 评论 -
Max points on a line
一、要求: Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. 解析:①、先任取一个点,判断其他剩下的所有点是否在一条直线上,统计个数;②、如果该个数大于maximum,修改maximum,③、继续选取下一个点,重复①②,直到全部点遍历完。原创 2016-09-16 20:39:52 · 216 阅读 · 0 评论 -
对链表排序
一、要求: Sort a linked list in O(n log n) time using constant space complexity. 二、分析: 使用o(nlogn)的时间复杂度和常量空间复杂度,对链表排序,只能使用归并排序。归并排序是将两个或两个以上的有序链表合并成一个新的链表。常见的是二路归并排序算法,思想是将数组或链表中前后相邻的两个有序序列归并为一个有序序列,原创 2016-09-17 11:12:34 · 294 阅读 · 0 评论