We use two Bind server to realize view, master, slave-------------------------------------------------------------------------------------------------...
分类:
其他好文 时间:
2014-07-22 22:57:13
阅读次数:
299
Two elements of a binary search tree (BST) are swapped by mistake.
Recover the tree without changing its structure.
Note:
A solution using O(n)
space is pretty straight forward. Could you devis...
分类:
其他好文 时间:
2014-07-18 22:33:04
阅读次数:
328
/*
D - 简单dp 例题
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
Submit
Status
Description
Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum ...
分类:
其他好文 时间:
2014-07-18 22:23:25
阅读次数:
231
UVA 10165 - Stone Game
题目链接
题意:给定n堆石子,每次能在一堆取1到多个,取到最后一个赢,问谁赢
思路:就裸的的Nim游戏,利用定理求解
代码:
#include
#include
int n, num;
int main() {
while (~scanf("%d", &n) && n) {
int sum = 0;
...
分类:
其他好文 时间:
2014-07-18 22:17:20
阅读次数:
342
A typical DFS usage, no big deal:class Solution {public: int dfs(TreeNode *p, int pval) { if( !p->left && !p->right ) { ...
分类:
其他好文 时间:
2014-07-17 09:55:25
阅读次数:
171
class Solution {public: bool canJump(int A[], int n) { if (A == NULL || n sum(n, 0); int jump = A[n-1]; for (int i=n-...
分类:
其他好文 时间:
2014-07-17 00:01:54
阅读次数:
292
1. 定义http://en.wikipedia.org/wiki/Adapter_patternAn adapter helps two incompatible interfaces to work together. This is the real world definition for ...
分类:
其他好文 时间:
2014-07-16 19:01:47
阅读次数:
345
Search and Replace
Sublime Text features two main types of search:
Search - Single FileSearch - Multiple Files
We’ll examine them in turn, but first let’s talk about a powerful tool for searc...
分类:
其他好文 时间:
2014-07-16 16:18:52
阅读次数:
312
Repost from:http://blog.csdn.net/yutianzuijin/article/details/11499917这是我做的第二个leetcode题目,一开始以为和第一个一样很简单,但是做的过程中才发现这个题目非常难,给人一种“刚上战场就踩上地雷挂掉了”的感觉。后来搜了一下...
分类:
其他好文 时间:
2014-07-16 15:19:06
阅读次数:
244
Given a number ‘n’, find the smallest number ‘p’ such that if we multiply all digits of ‘p’, we get ‘n’. The result ‘p’ should have minimum two digits...
分类:
其他好文 时间:
2014-07-16 08:55:04
阅读次数:
208