Given an array of integers, return indices of the two numbers such that they add up to ...

Given an array of integers, return indices of the two numbers such that they add up to ...
有 N 件物品和一个容量为 V 的背包。第 i 件物品的费用是 c[i],价值是 w[i]。求解将哪些物品装入背包可使价值总和最大 f[i][v]表示前 i 件物品恰放入一个...
要求要求恰装满背包在初始化时除了 f[0]为 0 其它 f[1..V]均设为-∞,这样就可以保证最终得到的f[N]是一种恰好装满背包的最优解。可以这样理解:初始化的 f 数组...
有 N 种物品和一个容量为 V 的背包,每种物品都有无限件可用。第 i 种物品的费用是 c[i],价值是 w[i]。求解将哪些物品装入背包可使这些物品的费用总和不超过背包容量...
There is a fence with n posts, each post can be painted with one of the k colors. You h...
Given a positive integer n, find the least number of perfect square numbers (for exampl...
Given an unsorted array of integers, find the length of longest increasing subsequence....
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ ...
Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by ...
Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by ...
You are given coins of different denominations and a total amount of money amount. Writ...
Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose pr...
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num c...
Given a positive integer n, break it into the sum of at least two positive integers and...
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix ...
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagra...
Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How...
Given a m x n grid filled with non-negative numbers, find a path from top left to botto...
You are a professional robber planning to rob houses along a street. Each house has a c...
Note: This is an extension of House Robber.After robbing those houses on that street, t...