摘要: Given an array of integers sorted in ascending order, find the starting and ending position of a given target value. Your algorithm's runtime complexi 阅读全文
posted @ 2017-10-16 08:24 daniel456 阅读(134) 评论(0) 推荐(0) 编辑
摘要: Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You a 阅读全文
posted @ 2017-10-16 07:58 daniel456 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. 阅读全文
posted @ 2017-10-16 07:56 daniel456 阅读(88) 评论(0) 推荐(0) 编辑
摘要: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of 阅读全文
posted @ 2017-10-16 07:54 daniel456 阅读(110) 评论(0) 推荐(0) 编辑
摘要: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo 阅读全文
posted @ 2017-10-16 07:53 daniel456 阅读(112) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo 阅读全文
posted @ 2017-10-15 16:52 daniel456 阅读(126) 评论(0) 推荐(0) 编辑
摘要: Given an unsorted array of integers, find the length of longest continuous increasing subsequence. Example 1: Example 2: Note: Length of the array wil 阅读全文
posted @ 2017-10-15 16:47 daniel456 阅读(117) 评论(0) 推荐(0) 编辑
摘要: Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element. We define an array is non-decr 阅读全文
posted @ 2017-10-15 16:31 daniel456 阅读(145) 评论(0) 推荐(0) 编辑
摘要: Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the ave 阅读全文
posted @ 2017-10-15 11:38 daniel456 阅读(134) 评论(0) 推荐(0) 编辑
摘要: Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value. And you need to output the 阅读全文
posted @ 2017-10-15 11:13 daniel456 阅读(96) 评论(0) 推荐(0) 编辑