随笔分类 -  Array

上一页 1 ··· 4 5 6 7 8 9 10 下一页
摘要:Given a dictionary, find all of the longest words in the dictionary. Given a dictionary, find all of the longest words in the dictionary. Given a dict 阅读全文
posted @ 2016-07-10 07:12 北叶青藤 阅读(232) 评论(0) 推荐(0)
摘要:Given an integer array, heapify it into a min-heap array. For a heap array A, A[0] is the root of heap, and for each A[i], A[i * 2 + 1] is the left ch 阅读全文
posted @ 2016-07-10 07:05 北叶青藤 阅读(410) 评论(0) 推荐(0)
摘要:Coins in a Line I There are n coins in a line. Two players take turns to take one or two coins from right side until there are no more coins left. The 阅读全文
posted @ 2016-07-10 04:06 北叶青藤 阅读(210) 评论(0) 推荐(0)
摘要:Given an unsorted integer array, find the first missing positive integer. Example Given [1,2,0] return 3,and [3,4,-1,1] return 2. 分析: 我们只需要把1到A.length 阅读全文
posted @ 2016-07-09 12:24 北叶青藤 阅读(208) 评论(0) 推荐(0)
摘要:There is a fence with n posts, each post can be painted with one of the k colors.You have to paint all the posts such that no more than two adjacent f 阅读全文
posted @ 2016-07-09 06:41 北叶青藤 阅读(295) 评论(0) 推荐(0)
摘要:There are a row of n houses, each house can be painted with one of the k colors. The cost of painting each house with a certain color is different. Yo 阅读全文
posted @ 2016-07-09 03:53 北叶青藤 阅读(282) 评论(0) 推荐(0)
摘要:Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. 阅读全文
posted @ 2016-07-08 05:14 北叶青藤 阅读(156) 评论(0) 推荐(0)
摘要:Given a sequence of integers, find the longest increasing subsequence (LIS). You code should return the length of the LIS. Clarification What's the de 阅读全文
posted @ 2016-07-08 00:58 北叶青藤 阅读(245) 评论(0) 推荐(0)
摘要:Maximum Subarray Given an array of integers, find a contiguous subarray which has the largest sum. Notice The subarray should contain at least one num 阅读全文
posted @ 2016-07-06 11:10 北叶青藤 阅读(216) 评论(0) 推荐(0)
摘要:Search a 2D Matrix II Write an efficient algorithm that searches for a value in an m x n matrix, return the occurrence of it. This matrix has the foll 阅读全文
posted @ 2016-07-06 10:43 北叶青藤 阅读(210) 评论(0) 推荐(0)
摘要:Given a string and an offset, rotate string by offset. (rotate from left to right) Given a string and an offset, rotate string by offset. (rotate from 阅读全文
posted @ 2016-07-06 08:21 北叶青藤 阅读(233) 评论(0) 推荐(0)
摘要:Unique Paths I A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or 阅读全文
posted @ 2016-07-06 07:39 北叶青藤 阅读(164) 评论(0) 推荐(0)
摘要:For an array A, if i < j, and A [i] > A [j], called (A [i], A [j]) is a reverse pair.return total of reverse pairs in A. For an array A, if i < j, and 阅读全文
posted @ 2016-07-06 02:01 北叶青藤 阅读(220) 评论(0) 推荐(0)
摘要:Given a list of non negative integers, arrange them such that they form the largest number. Notice The result may be very large, so you need to return 阅读全文
posted @ 2016-07-05 09:48 北叶青藤 阅读(191) 评论(0) 推荐(0)
摘要: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 and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or 阅读全文
posted @ 2016-07-05 09:02 北叶青藤 阅读(200) 评论(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 北叶青藤 阅读(250) 评论(0) 推荐(0)
摘要:Backpack | Given n items with size Ai, an integer m denotes the size of a backpack. How full you can fill this backpack? Given n items with size Ai, a 阅读全文
posted @ 2016-07-05 04:35 北叶青藤 阅读(225) 评论(0) 推荐(0)

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