原创 Lintcode - k sum II

Given n unique integers, number k (1<=k<=n)  and target. Find all possible k integers where their sum is target. Exa

原创 Lintcode - Backpack II

Given n items with size A[i] and value V[i], and a backpack with size m. What's the maximum value can you put into the

原创 Lintcode - Remove Node in Binary Search Tree

Given a root of Binary Search Tree with unique value for each node.  Remove the node with given value. If there is no

原创 Lintcode - Maximum Subarray Difference

Given an array with integers. Find two non-overlapping subarrays A and B, which|SUM(A) - SUM(B)| is the largest. Re

原创 Lintcode - Previous Permutation

Given a list of integers, which denote a permutation. Find the previous permutation in ascending order. Note The l

原创 Remove element

Given an array and a value, remove all instances of that value in place and return the new length. The order of elem

原创 Longest Substring with At Most Two Distinct Characters

Given a string, find the length of the longest substring T that contains at most 2 distinct characters. For example,

原创 Palindrome Number

Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers. Some hints: Coul

原创 Lintcode - Serialization and Deserialization Of Binary Tree

Design an algorithm and write code to serialize and deserialize a binary tree. Writing the tree to a file is called '

原创 Lintcode - Minimum Adjustment Cost

Given an integer array, adjust each integers so that the difference of every adjcent integers are not greater than a

原创 Wildcard Matching

'?' Matches any single character. '*' Matches any sequence of characters (including the empty sequence). The matching

原创 Rotate Array

Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] 

原创 Lintcode - Majority Number III

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

原创 Lintcode - Maximum Subarray II

Given an array of integers, find two non-overlapping subarrays which have the largest sum. The number in each subarr

原创 Lintcode - Maximum Subarray III

Given an array of integers and a number k, find knon-overlapping subarrays which have the largest sum. The number in