摘要: Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. 考数学和抠细节。O(n2)。每对点都要遍历。先固定第一个点,从第一个点开始跟后面每个点计算斜率,存到 阅读全文
posted @ 2017-11-12 14:56 jasminemzy 阅读(129) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmet 阅读全文
posted @ 2017-11-12 09:57 jasminemzy 阅读(172) 评论(0) 推荐(0) 编辑
摘要: Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initia 阅读全文
posted @ 2017-11-12 08:19 jasminemzy 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Given a collection of intervals, merge all overlapping intervals. For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18]. 先写comparat 阅读全文
posted @ 2017-11-12 06:37 jasminemzy 阅读(127) 评论(0) 推荐(0) 编辑