自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(42)
  • 收藏
  • 关注

转载 Maximum Subarray Difference

Description:Given an array with integers.Find two non-overlapping subarrays A and B, which |SUM(A) - SUM(B)| is the largest.Return the largest difference.ExampleFor [1, 2, -3, 1], return 6...

2015-10-16 03:08:00 88

转载 Trapping Rain Water II

Description:Given n x m non-negative integers representing an elevation map 2d where the area of each cell is 1 x 1, compute how much water it is able to trap after raining.ExampleGiven 5*4 ...

2015-10-15 02:53:00 133

转载 Trapping Rain Water

Description:Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.ExampleGiven [0,1,0,2,1,0,1,...

2015-10-15 01:45:00 73

转载 Minimum Window Substring

Description:Given a string source and a string target, find the minimum window in source which will contain all the characters in target.Examplesource = "ADOBECODEBANC" target = "ABC" Minimum...

2015-10-13 17:40:00 66

转载 Sliding Window Maximum

Description:Given an array of n integer with duplicate number, and a moving window(size k), move the window at each iteration from the start of the array, find the maximum number inside the win...

2015-10-12 02:20:00 67

转载 Data Stream Median

Description:Numbers keep coming, return the median of numbers at every time a new number added.ExampleFor numbers coming list: [1, 2, 3, 4, 5], return [1, 1, 2, 2, 3].For numbers coming list...

2015-10-10 17:01:00 70

转载 Sliding Window Median

Description:Given an array of n integer, and a moving window(size k), move the window at each iteration from the start of the array, find the median of the element inside the window at each mov...

2015-10-10 16:25:00 80

转载 Word Search II

Description:Given a matrix of lower alphabets and a dictionary. Find all words in the dictionary that can be found in the matrix. A word can start from any position in the matrix and go left/ri...

2015-09-30 05:41:00 55

转载 Maximum Gap

Description:Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Return 0 if the array contains less than 2 elements. so that objects of the ...

2015-09-19 04:09:00 62

转载 Sort Colors II

Description:Given an array of n objects with k different colors (numbered from 1 to k), sort them so that objects of the same color are adjacent, with the colors in the order 1, 2, ... k.Examp...

2015-09-18 20:13:00 89

转载 Nuts & Bolts Problem

Description:Given a set of n nuts of different sizes and n bolts of different sizes. There is a one-one mapping between nuts and bolts. Comparison of a nut to another nut or a bolt to another b...

2015-09-16 22:23:00 277

转载 Longest Increasing Subsequence

Description:Given a sequence of integers, find the longest increasing subsequence (LIS).You code should return the length of the LIS.ExampleFor [5, 4, 1, 2, 3], the LIS is [1, 2, 3], return ...

2015-09-15 17:49:00 53

转载 Number of Airplanes in the Sky

Description:Given an array of integers and a number k, the majority number is the number that occurs more than 1/k of the size of the array.Find it.ExampleFor interval list [[1,10],[2,3],[5,...

2015-09-15 15:30:00 64

转载 Majority Number III

Description:Given an array of integers and a number k, the majority number is the number that occurs more than 1/k of the size of the array.Find it.ExampleGiven [3,1,2,3,2,3,3,4,4,4] and k=3...

2015-09-15 04:44:00 57

转载 Find Peak Element II

Description:There is an integer matrix which has the following features:The numbers in adjacent positions are different.The matrix has n rows and m columns.For all i < m, A[0][i] < A[...

2015-09-15 02:53:00 108

转载 Valid Number

Description:Validate if a given string is numeric.Example"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueSolution:class Solution {public: /** ...

2015-09-13 17:11:00 45

转载 Sort Colors

Description:Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will u...

2015-09-13 16:44:00 38

转载 Edit Distance

Description:Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations perm...

2015-09-13 04:13:00 60

转载 Copy List with Random Pointer

Description: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 of the list.ChallengeCould y...

2015-09-13 03:23:00 41

转载 Continuous Subarray Sum II

Description:Given an integer array, find a continuous rotate subarray where the sum of numbers is the biggest. Your code should return the index of the first number and the index of the last nu...

2015-09-11 20:42:00 85

转载 Best Time to Buy and Sell Stock III

Description:Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactions.Ex...

2015-09-11 03:49:00 41

转载 Find the Weak Connected Component in the Directed Graph

Description:Find the number Weak Connected Component in the directed graph. Each node in the graph contains a label and a list of its neighbors. (a connected set of a directed graph is a subgra...

2015-09-11 01:50:00 91

转载 Delete Digits

Description:Given string A representative a positive integer which has N digits, remove any k digits of the number, the remaining digits are arranged according to the original order to become a...

2015-09-10 21:59:00 76

转载 Update Bits

Description:Given two 32-bit numbers, N and M, and two bit positions, i and j. Write a method to set all bits between i and j in N equal to M (e g , M becomes a substring of N located at i and ...

2015-09-10 04:41:00 78

转载 Minimum Size Subarray Sum

Description:Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return 0 instead.For example, given ...

2015-09-10 03:01:00 81

转载 Expression Tree Build

Description:The structure of Expression Tree is a binary tree to evaluate certain expressions. All leaves of the Expression Tree have an number string value. All non-leaves of the Expression Tr...

2015-09-09 20:52:00 76

转载 Kth Smallest Number in Sorted Matrix

Description:Find the kth smallest number in at row and column sorted matrix.Example,Given k = 4 and a matrix:[ [1 ,5 ,7], [3 ,7 ,8], [4 ,8 ,9],]return 5ChallengeO(k log n), n is th...

2015-09-09 16:03:00 112

转载 Permutations II

Description:Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the following unique permutations:[1,1,2], [1,2,1], ...

2015-08-29 05:02:00 38

转载 Word Break

Description:Given a string s and a dictionary of words dict, determine if s can be break into a space-separated sequence of one or more dictionary words.ExampleGiven s = "lintcode", dict = ["...

2015-08-28 21:06:00 46

转载 House Robber II

Description:After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time, all houses at this place a...

2015-08-28 20:28:00 64

转载 Product of Array Except Self

Description:Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without di...

2015-08-28 02:15:00 49

转载 Container With Most Water

Description: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 endpoints of line i is at (i, ai) an...

2015-08-27 05:39:00 55

转载 Single Number III

Description:Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.For exam...

2015-08-26 04:05:00 52

转载 Majority Element II

Description:Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space.Solution:class Solution {publi...

2015-08-26 03:31:00 56

转载 Maximal Square

Description:Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.For example, given the following matrix:1 0 1 0 01 0 1 1 11 1 1 ...

2015-08-25 21:12:00 48

转载 Find Peak Element

Description:A peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.The array may contain multip...

2015-08-20 02:54:00 34

转载 Largest Number

Description:Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.Note: The res...

2015-08-18 00:10:00 34

转载 Reverse Bits

Description:Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in bin...

2015-08-16 14:41:00 45

转载 Implement Stack using Queues

Description:Implement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get the top element.em...

2015-08-13 00:00:00 43

转载 Palindrome Linked List

Description:Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?Solution:class Solution {public: bool isPalindrome(ListNo...

2015-08-12 21:14:00 40

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除