随笔分类 -  Google

上一页 1 ··· 5 6 7 8 9 10 下一页
摘要: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 北叶青藤 阅读(179) 评论(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 北叶青藤 阅读(185) 评论(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 北叶青藤 阅读(165) 评论(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 北叶青藤 阅读(216) 评论(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 北叶青藤 阅读(239) 评论(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 北叶青藤 阅读(326) 评论(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 北叶青藤 阅读(242) 评论(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 北叶青藤 阅读(245) 评论(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 北叶青藤 阅读(194) 评论(0) 推荐(0)
摘要:Given a singly linked list L: L0 → L1 → … → Ln-1 → Ln reorder it to: L0 → Ln → L1 → Ln-1 → L2 → Ln-2 → … Example Given 1->2->3->4->null, reorder it to 阅读全文
posted @ 2016-07-03 10:33 北叶青藤 阅读(174) 评论(0) 推荐(0)
摘要:Sort a linked list in O(n log n) time using constant space complexity. Example Given 1->3->2->null, sort it to 1->2->3->null. Merge Sort version 1 /** 阅读全文
posted @ 2016-07-03 10:24 北叶青藤 阅读(185) 评论(0) 推荐(0)
摘要:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy 阅读全文
posted @ 2016-07-03 06:55 北叶青藤 阅读(180) 评论(0) 推荐(0)
摘要:Remove Duplicates from Sorted List I Given a sorted linked list, delete all duplicates such that each element appear only once. Remove Duplicates from 阅读全文
posted @ 2016-07-03 04:36 北叶青藤 阅读(195) 评论(0) 推荐(0)
摘要:Merge two sorted (ascending) linked lists and return it as a new sorted list. The new sorted list should be made by splicing together the nodes of the 阅读全文
posted @ 2016-07-03 04:22 北叶青藤 阅读(140) 评论(0) 推荐(0)
摘要:Given a linked list, remove the nth node from the end of list and return its head. Notice The minimum number of nodes in list is n. Example Given link 阅读全文
posted @ 2016-07-03 02:34 北叶青藤 阅读(156) 评论(0) 推荐(0)
摘要:Remove all elements from a linked list of integers that have value val. Example Given 1->2->3->3->4->5->3, val = 3, you should return the list as 1->2 阅读全文
posted @ 2016-07-02 11:24 北叶青藤 阅读(183) 评论(0) 推荐(0)
摘要:Given an integers array A. Define B[i] = A[0] * ... * A[i-1] * A[i+1] * ... * A[n-1], calculate B WITHOUT divide operation. Example For A = [1, 2, 3], 阅读全文
posted @ 2016-07-01 11:05 北叶青藤 阅读(373) 评论(0) 推荐(0)
摘要:Given two sorted integer arrays A and B, merge B into A as one sorted array. Notice You may assume that A has enough space (size that is greater or eq 阅读全文
posted @ 2016-07-01 10:41 北叶青藤 阅读(146) 评论(0) 推荐(0)
摘要:Remove Duplicates from Sorted Array I Given a sorted array, remove the duplicates in place such that each element appear only once and return the new 阅读全文
posted @ 2016-07-01 08:49 北叶青藤 阅读(156) 评论(0) 推荐(0)
摘要:560. Subarray Sum Equals K Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to  阅读全文
posted @ 2016-07-01 07:57 北叶青藤 阅读(228) 评论(0) 推荐(0)

上一页 1 ··· 5 6 7 8 9 10 下一页