上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 19 下一页
摘要: Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Try to solve it in linear time/space. Return 阅读全文
posted @ 2015-06-23 17:18 linqiaozhou 阅读(813) 评论(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]. 这里先排序,然后 阅读全文
posted @ 2015-06-19 15:54 linqiaozhou 阅读(298) 评论(0) 推荐(0) 编辑
摘要: Sort a linked list in O(n log n) time using constant space complexity. 对一个链表进行排序,且时间复杂度要求为 O(n log n) ,空间复杂度为常量。一看到 O(n log n) 的排序,首先应该想到归并排序和快速排序,但是通 阅读全文
posted @ 2015-06-18 11:31 linqiaozhou 阅读(10576) 评论(0) 推荐(4) 编辑
摘要: Single Number I Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linea 阅读全文
posted @ 2015-06-16 19:57 linqiaozhou 阅读(231) 评论(0) 推荐(0) 编辑
摘要: Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. Did you use extra space?A straight forward solution usin 阅读全文
posted @ 2015-06-16 16:49 linqiaozhou 阅读(431) 评论(0) 推荐(0) 编辑
摘要: A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], find a peak element and return its inde 阅读全文
posted @ 2015-06-16 11:24 linqiaozhou 阅读(450) 评论(0) 推荐(0) 编辑
摘要: You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up: Could you do this in-place? 这题有三种思路: 思路 阅读全文
posted @ 2015-06-16 09:27 linqiaozhou 阅读(402) 评论(0) 推荐(0) 编辑
摘要: Find Minimum in Rotated Sorted Array I Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 阅读全文
posted @ 2015-06-15 22:18 linqiaozhou 阅读(291) 评论(0) 推荐(0) 编辑
摘要: Search in Rotated Sorted Array I Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 阅读全文
posted @ 2015-06-15 16:46 linqiaozhou 阅读(269) 评论(0) 推荐(0) 编辑
摘要: Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. 【题意】 求二维平面上n个点中,最多共线的点数。 转自:http://blog.csdn.net/d 阅读全文
posted @ 2015-06-15 14:45 linqiaozhou 阅读(285) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 19 下一页