Given an unsorted integer array, find the first
missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1]
return 2.Your algorithm sho...
分类:
其他好文 时间:
2014-05-16 02:58:54
阅读次数:
249
Problem Description
XX星有许多城市,城市之间通过一种奇怪的高速公路SARS(Super Air Roam Structure---超级空中漫游结构)进行交流,每条SARS都对行驶在上面的Flycar限制了固定的Speed,同时XX星人对 Flycar的“舒适度”有特殊要求,即乘坐过程中最高速度与最低速度的差越小乘坐越舒服 ,(理解为SARS的限速要求,flycar必须瞬间提...
分类:
其他好文 时间:
2014-05-16 01:43:49
阅读次数:
270
原题:
题目解析:这个问题的实质是要我们按成访问二叉树的结点,并返回每层访问的结果,这里要求走Z字,其实就是一行正向一行反向。
/*
the kernel idea is visit a binary search tree in level and
the additional work we have to label the end of one level.
*/
v...
分类:
其他好文 时间:
2014-05-15 23:18:46
阅读次数:
515
【题目】
原文:
1.7 Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column is set to 0.
译文:
写一个函数处理一个MxN的矩阵,如果矩阵中某个元素为0,那么把它所在的行和列都置为0.
【分析】
【思路一】
遍历一次矩阵...
分类:
其他好文 时间:
2014-05-15 12:27:37
阅读次数:
293
题目链接:http://poj.org/problem?id=2135
Farm Tour
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 10862
Accepted: 4024
Description
When FJ's f...
分类:
其他好文 时间:
2014-05-15 11:24:14
阅读次数:
348
题目链接:http://poj.org/problem?id=3469
Dual Core CPU
Time Limit: 15000MS
Memory Limit: 131072K
Total Submissions: 18147
Accepted: 7833
Case Time Limit: 5000MS
...
分类:
其他好文 时间:
2014-05-15 06:23:05
阅读次数:
271
Single Number II
Total Accepted: 14472 Total
Submissions: 44420My Submissions
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Y...
分类:
其他好文 时间:
2014-05-15 01:23:42
阅读次数:
273
Linked List Cycle
Total Accepted: 17148 Total
Submissions: 49300My Submissions
Given a linked list, determine if it has a cycle in it.
Follow up:
Can you solve it without using extra sp...
分类:
其他好文 时间:
2014-05-15 00:13:50
阅读次数:
279
Total Accepted: 8400 Total Submissions: 38235 My Submissions
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 profi...
分类:
其他好文 时间:
2014-05-14 19:39:53
阅读次数:
275
/*
* hdu OpenDoorManAndCloseDoorMan
* date 2014/5/13
* state AC
*/
#include
#include
#include
#include
using namespace std;
struct DoorMan
{
char name[20];
int startH,startM,startS;
...
分类:
其他好文 时间:
2014-05-14 14:58:40
阅读次数:
247