随笔分类 -  Level 3

上一页 1 ··· 5 6 7 8 9 10 下一页
摘要:Best Time to Buy and Sell Stock I Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted t 阅读全文
posted @ 2016-07-05 09:14 北叶青藤 阅读(238) 评论(0) 推荐(0)
摘要:Given a sorted array of n integers, find the starting and ending position of a given target value. If the target is not found in the array, return [-1 阅读全文
posted @ 2016-07-05 08:56 北叶青藤 阅读(135) 评论(0) 推荐(0)
摘要:There are two sorted arrays A and B of size m and nrespectively. Find the median of the two sorted arrays. There are two sorted arrays A and B of size 阅读全文
posted @ 2016-07-05 07:55 北叶青藤 阅读(206) 评论(0) 推荐(0)
摘要:Combination Sum | Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to  阅读全文
posted @ 2016-07-05 04:46 北叶青藤 阅读(251) 评论(0) 推荐(0)
摘要: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)
摘要: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 北叶青藤 阅读(249) 评论(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 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)
摘要: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)
摘要:Reverse Linked List I Reverse a linked list. Example For linked list 1->2->3, the reversed linked list is 3->2->1 分析: 典型的3 pointers 问题。 1 /** 2 * Defi 阅读全文
posted @ 2016-07-03 07:32 北叶青藤 阅读(192) 评论(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 北叶青藤 阅读(196) 评论(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)
摘要:Sort a linked list using insertion sort. Sort a linked list using insertion sort. Sort a linked list using insertion sort. Example Given 1->3->2->0->n 阅读全文
posted @ 2016-07-03 00:37 北叶青藤 阅读(132) 评论(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 北叶青藤 阅读(374) 评论(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)
摘要:Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that 阅读全文
posted @ 2016-07-01 04:55 北叶青藤 阅读(162) 评论(0) 推荐(0)
摘要:Flatten a binary tree to a fake "linked list" in pre-order traversal. Here we use the right pointer in TreeNode as the next pointer in ListNode. For e 阅读全文
posted @ 2016-07-01 02:31 北叶青藤 阅读(275) 评论(0) 推荐(0)
摘要:Given an integer array, adjust each integers so that the difference of every adjacent integers are not greater than a given number target. If the arra 阅读全文
posted @ 2016-06-29 10:57 北叶青藤 阅读(522) 评论(0) 推荐(0)
摘要:Word Search I Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell 阅读全文
posted @ 2016-06-29 03:13 北叶青藤 阅读(313) 评论(0) 推荐(0)
摘要:问题: 给你一个字符串,里面只包含"(",")","[","]"四种符号,请问你需要至少添加多少个括号才能使这些括号匹配起来。如:[]是匹配的,所需括号个数为 0.([])[]是匹配的, 所需括号个数为 0.((]是不匹配的, 所需最少括号个数为 3.([)]是不匹配的,所需最少括号个数为 2. 分 阅读全文
posted @ 2015-06-25 05:26 北叶青藤 阅读(1167) 评论(0) 推荐(0)

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