1 #include 2 #define MAXN 20 3 using namespace std; 4 5 int value[MAXN]; 6 int place[MAXN]; 7 int dp[MAXN][15000]; 8 9 int main()10 {11 //freo...
分类:
其他好文 时间:
2015-06-10 17:11:59
阅读次数:
95
#include #define MAXN 20using namespace std;int value[MAXN];int place[MAXN];int dp[MAXN][15000];int main(){ //freopen("acm.acm","r",stdin); int ...
分类:
其他好文 时间:
2015-06-10 17:04:39
阅读次数:
92
Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue",
return "blue is sky the".
Update (2015-02-12):
For C programmers: Try to solve it in-place in...
分类:
其他好文 时间:
2015-06-10 08:53:02
阅读次数:
96
Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t...
分类:
其他好文 时间:
2015-06-10 07:41:49
阅读次数:
105
Note: This is an extension of House Robber.After robbing those houses on that street, the thief has found himself a new place for his thievery so that...
分类:
编程语言 时间:
2015-06-09 21:27:40
阅读次数:
197
You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
Follow up:
Could you do this in-place?
题目解读:
将一个矩阵顺时针旋转90度。
方法一:
如下图所示,先转置,之后和变换的单位矩阵相乘...
分类:
其他好文 时间:
2015-06-09 17:23:38
阅读次数:
129
Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn’t matter what you leave beyond the new length.思路:遍历数组,如果...
分类:
其他好文 时间:
2015-06-09 11:59:43
阅读次数:
115
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with cons...
分类:
其他好文 时间:
2015-06-09 11:58:43
阅读次数:
86
Given an m x n chessboard where you want to place chess knights. You have to find the number of maximum knights that can be placed in the chessboard such that no two knights attack each other.Those who...
分类:
其他好文 时间:
2015-06-08 17:32:11
阅读次数:
118
C - Exam
Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d
& %I64u
Submit Status
Description
An exam for n students will take place in a long and narrow room, so th...
分类:
其他好文 时间:
2015-06-07 13:56:37
阅读次数:
122