[LeetCode] 279. Perfect Squares

2018-12-10
阅读 1 分钟
1.7k
Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n.

[LeetCode] 727. Minimum Window Subsequence

2018-12-05
阅读 2 分钟
3k
Given strings S and T, find the minimum (contiguous) substring W of S, so that T is a subsequence of W.

[LeetCode] 312. Burst Balloons

2018-12-03
阅读 2 分钟
1.6k
Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloons. If the you burst balloon i you will get nums[left] nums[i] nums[right] coins. Here left and right are adjacent indices of i. After the burst, th...

[LeetCode] 120. Triangle

2018-11-27
阅读 2 分钟
2k
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.

[LeetCode] 568. Maximum Vacation Days

2018-11-12
阅读 4 分钟
3.7k
LeetCode wants to give one of its best employees the option to travel among N cities to collect algorithm problems. But all work and no play makes Jack a dull boy, you could take vacations in some particular cities and weeks. Your job is to schedule the traveling to maximize the number of vacatio...

[LeetCode] 322. Coin Change

2018-11-05
阅读 1 分钟
1.8k
You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1.

[LeetCode] 689. Maximum Sum of 3 Non-Overlapping Subarrays

2018-10-24
阅读 3 分钟
2.1k
In a given array nums of positive integers, find three non-overlapping subarrays with maximum sum.

[LeetCode] 32. Longest Valid Parentheses

2018-09-24
阅读 2 分钟
2.2k
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.

[LeetCode] 303. Range Sum Query - Immutable

2018-08-02
阅读 1 分钟
1.4k
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.

[LeetCode] Maximum Subarray

2018-01-15
阅读 1 分钟
2.1k
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.

[LintCode] Longest Repeating Subsequence

2018-01-10
阅读 1 分钟
2.9k
Given a string, find length of the longest repeating subsequence such that the two subsequence don’t have same string character at same position, i.e., any ith character in the two subsequences shouldn’t have the same index in the original string.

[LintCode] Climbing Stairs II

2018-01-07
阅读 1 分钟
1.9k
A child is running up a staircase with n steps, and can hop either 1 step, 2 steps, or 3 steps at a time. Implement a method to count how many possible ways the child can run up the stairs.

[LintCode] Backpack I II III IV V VI [背包六问]

2016-08-15
阅读 5 分钟
17.2k
Given n items with size Ai, an integer m denotes the size of a backpack. How full you can fill this backpack?

[LintCode] Longest Increasing Subsequence

2016-07-29
阅读 2 分钟
1.9k
Given a sequence of integers, find the longest increasing subsequence (LIS).

[LeetCode] 38. Count and Say

2016-06-17
阅读 2 分钟
2.1k
The count-and-say sequence is the sequence of integers beginning as follows:

[LeetCode] Range Sum Query Immutable

2016-06-02
阅读 1 分钟
2.1k
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.

[LeetCode] Counting Bits

2016-05-31
阅读 1 分钟
2k
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.

[LeetCode] Integer Break

2016-05-30
阅读 2 分钟
2.6k
Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get.

[LintCode/LeetCode] Scramble String

2016-05-30
阅读 2 分钟
2k
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.

[LintCode/LeetCode] Wildcard Matching

2016-05-24
阅读 3 分钟
2.1k
'?' Matches any single character.'*' Matches any sequence of characters (including the empty sequence).The matching should cover the entire input string (not partial).

[LintCode/LeetCode] Decode Ways [String to Integer]

2016-05-23
阅读 2 分钟
2.4k
A message containing letters from A-Z is being encoded to numbers using the following mapping:

[LintCode/LeetCode] House Robber III

2016-04-29
阅读 2 分钟
2.2k
The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each house has one and only one parent house. After a tour, the smart thief realized that "all houses in this place forms a binary tree". It will automatic...

[LintCode/LeetCode] House Robber II

2016-04-29
阅读 2 分钟
1.9k
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 are arranged in a circle. That means the first house is the neighbor of the last one. Meanwhile, the security system ...

[LintCode] k Sum [三维动态规划]

2016-04-22
阅读 2 分钟
7.5k
Given n distinct positive integers, integer k (k <= n) and a number target.

[LintCode] Palindrome Partitioning II

2016-04-19
阅读 1 分钟
2k
Given a string s, cut s into some substrings such that every substring is a palindrome.

[LintCode/LeetCode] Word Break

2016-04-19
阅读 2 分钟
2.3k
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.

[LintCode/LeetCode] Triangle

2016-04-17
阅读 2 分钟
1.7k
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.

[LintCode/LeetCode] Minimum Path Sum

2016-04-17
阅读 1 分钟
2.3k
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.

[LintCode] Climbing Stairs

2016-04-17
阅读 1 分钟
1.7k
Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

[LintCode/LeetCode] Unique Paths II

2016-04-17
阅读 2 分钟
1.9k
Now consider if some obstacles are added to the grids. How many unique paths would there be?