Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.You may assume no duplicate exists in the array.方法一:直...
分类:
其他好文 时间:
2015-06-11 13:05:41
阅读次数:
135
A peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.The array may contain multiple peaks, in that case...
分类:
其他好文 时间:
2015-06-11 13:04:38
阅读次数:
115
1 #include 2 #define MAXN 50000 3 using namespace std; 4 5 int parent[MAXN]; 6 int Find_set(int); 7 void Make_set(int); 8 void Union(int,int); 9 int.....
分类:
其他好文 时间:
2015-06-11 12:57:17
阅读次数:
132
题目描述Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longes...
分类:
其他好文 时间:
2015-06-11 12:36:10
阅读次数:
110
某程序(进程)在运行的时候可能挂掉,需要去监控该程序,并在它挂掉的时候重启之,确保该程序能一直运行。Linux下面似乎有守护进程的概念,Windows下面其实也很简单,批处理就可以搞定:但需要了解如下几个命令tasklist+find,ping。tasklist是列出所有进程,可以指定只列出某..
分类:
Windows程序 时间:
2015-06-11 11:14:27
阅读次数:
1351
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm’s runtime complexity must be in the order of O(log n).If the target is not found in the ar...
分类:
其他好文 时间:
2015-06-11 11:07:35
阅读次数:
98
代码:
#include
#include
#include
using namespace std;
int father[1005];
int son_cnt[1005];
char s[5];
//int cnt;
struct point
{
double x,y;
};
point a[1005],b[1005];
int find_father(int x)
{
...
分类:
其他好文 时间:
2015-06-11 09:33:46
阅读次数:
171
由于数据需求,需要频繁抓取和筛选过滤数据,用了大约7 8个月,在机器上改了下数据,重启,发现“No space left on device”
解决方法:
直接删除日志(简单粗暴):
删除所有的日志:find /var -type f -exec rm -v {} \;(最后的分号也是必须命令的一部分)...
分类:
系统相关 时间:
2015-06-10 22:37:21
阅读次数:
171
1. Question给一整数数组,找两个数,使其和正好是给定值。函数 twoSum应当返回两个数的索引,且index1小于index2。索引不是从0开始的。假设每个输入都正好有一个解。Given an array of integers, find two numbers such that th...
分类:
其他好文 时间:
2015-06-10 22:11:08
阅读次数:
152
Maximum Subarray IIIGiven an array of integers and a numberk, find knon-overlappingsubarrays which have the largest sum.The number in each subarray sh...
分类:
其他好文 时间:
2015-06-10 19:19:20
阅读次数:
170