摘要: Jump Game | Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represent 阅读全文
posted @ 2016-07-05 03:18 北叶青藤 阅读(167) 评论(0) 推荐(0) 编辑
摘要: Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Clarification Your algorithm should run in O(n) com 阅读全文
posted @ 2016-07-05 01:48 北叶青藤 阅读(181) 评论(0) 推荐(0) 编辑
摘要: k Sum Given n distinct positive integers, integer k (k <= n) and a number target. Find k numbers where sum is target. Calculate how many solutions the 阅读全文
posted @ 2016-07-05 00:55 北叶青藤 阅读(238) 评论(0) 推荐(0) 编辑
摘要: Single Number Given 2*n + 1 numbers, every numbers occurs twice except one, find it. Example Given [1,2,2,1,3,4,3], return 4 分析: 利用bit operator ^ 的特点即 阅读全文
posted @ 2016-07-04 11:27 北叶青藤 阅读(155) 评论(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 @ 2016-07-04 10:30 北叶青藤 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 3 Sum Given an array S of n integers, are there elements a, b, c in Ssuch that a + b + c = 0? Find all unique triplets in the array which gives the su 阅读全文
posted @ 2016-07-04 07:24 北叶青藤 阅读(230) 评论(0) 推荐(0) 编辑
摘要: Two Sum I Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of 阅读全文
posted @ 2016-07-04 07:13 北叶青藤 阅读(313) 评论(0) 推荐(0) 编辑
摘要: Given a collection of distinct numbers, return all possible permutations. For example,[1,2,3] have the following permutations: [ [1,2,3], [1,3,2], [2, 阅读全文
posted @ 2016-07-04 05:29 北叶青藤 阅读(233) 评论(0) 推荐(0) 编辑
摘要: For a given sorted array (ascending order) and a target number, find the first index of this number in O(log n) time complexity. If the target number 阅读全文
posted @ 2016-07-04 01:22 北叶青藤 阅读(234) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, determine if it has a cycle in it. Given a linked list, determine if it has a cycle in it. Given a linked list, determine if it h 阅读全文
posted @ 2016-07-03 11:45 北叶青藤 阅读(186) 评论(0) 推荐(0) 编辑