- 博客(5)
- 资源 (1)
- 收藏
- 关注
原创 LeetCode: Reverse Words in a String [151]
【题目】 Given an input string, reverse the string word by word. For example, Given s = "the sky is blue", return "blue is sky the". click to show clarification. Clarification: What constitutes a word? A sequence of non-space characters constitutes a word.
2014-07-01 19:40:35 1167
原创 LeetCode: Evaluate Reverse Polish Notation [150]
【题目】 Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each operand may be an integer or another expression. Some examples: ["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9 ["4", "13", "5", "/
2014-07-01 19:38:28 1016
原创 LeetCode: Max Points on a Line [149]
【题目】 Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. 【题意】 给定一堆点,要求找出一条之前上的最大点数 【思路】 没什么好的方法,从每个点P出发,遍历所有的情况 从每个点P出发,斜率相同的点即为统一之前上的点 注意两种特殊情况: 1. 两个点重合(即为同一个点)
2014-07-01 19:34:48 1114
原创 LeetCode: Sort List [148]
【题目】 Sort a linked list in O(n log n) time using constant space complexity. 【题意】 排序一个链表,要求时间复杂度O(nlogn),使用常量空间 【思路】 nlogn的复杂度,用归并排序求解
2014-07-01 19:32:12 949
原创 LeetCode: Insertion Sort List [147]
【题目】 Sort a linked list using insertion sort. 【题意】 用插入排序方法排序链表 【思路】 直接搞
2014-07-01 19:30:07 927
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人