摘要:Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each operand may be an integer or another e...
阅读全文
摘要:Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's undirected graph serialization: Nodes are labeled...
阅读全文
摘要:Sort a linked list in O(n log n) time using constant space complexity.[Thoughts]O(nlgn)的排序算法没几个,无非就是quick sort, heap sort和merge sort. 对于链表排序来说,难点之一就是如...
阅读全文
摘要:Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.[Thoughts]任意一条直线都可以表述为y = ax + b假设,有两个点(x1,y1), (x2...
阅读全文