3D dungeon
时间限制:1000 ms | 内存限制:65535 KB
难度:2
描述You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not
be fil...
分类:
其他好文 时间:
2014-06-22 22:13:18
阅读次数:
223
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 ...
分类:
其他好文 时间:
2014-06-22 21:47:15
阅读次数:
269
我们经常会通过find命令进行批量操作,如:批量删除旧文件、批量修改、基于时间的文件统计、基于文件大小的文件统计等,在这些操作当中,由于rm删除操作会导致目录结构变化,如果要通过find结合rm的操作写成脚本,就会遇到一些麻烦,本文通过一个例子为大家进行介绍。...
分类:
系统相关 时间:
2014-06-22 18:21:10
阅读次数:
362
vector strsplit(const string& str)
{
vector vec;
string sstr1=str, sstr2="";
size_t np=0;
while (sstr1!="")
{
size_t dt = sstr1.find(',');
if (dt != string::npos)
{
sstr1 = str.substr(np...
分类:
其他好文 时间:
2014-06-22 18:06:11
阅读次数:
205
Given a triangle, find the minimum path sum from top to bottom. Each step you may
move to adjacent numbers on the row below.
For example, given the following triangle
[
[2],...
分类:
其他好文 时间:
2014-06-22 17:07:52
阅读次数:
166
最近学习了c++primer中的第11章的泛型算法,这一章的基础是c++中的容器,但是泛型算法是独立于特定的容器的,这样的算法不会改变容器的大小,这样保证了不管是哪种类型的容器都可以同时调用同一种算法来实现操作。
首先介绍下这些常用的算法的头文件,比较常用的是algorithm,numeric和iterator,最先遇到的函数是find()函数,需要三个参数,前两个是一般的算法函数都需要的,是一...
分类:
编程语言 时间:
2014-06-22 16:57:43
阅读次数:
277
在linux下写了一个非常简单的Hello world程序,编译运行竟然报错:Error: Could not find or load main class Hello
最后发现是CLASSPATH的问题。
首先需要检查jdk环境变量是否配置正确:参考这篇文章:ubuntu12.04 安装配置jdk1.7
主要在环境变量这块:
export JAVA_HOME=/usr/java/jdk...
分类:
系统相关 时间:
2014-06-22 08:58:51
阅读次数:
410
题目:
Given a binary tree containing digits from 0-9 only, each root-to-leaf
path could represent a number.
An example is the root-to-leaf path 1->2->3 which represents the number 123.
Find...
分类:
其他好文 时间:
2014-06-22 08:30:24
阅读次数:
236
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.
For example:
Given the below binary tree and sum = 22,
5
/ ...
分类:
其他好文 时间:
2014-06-21 22:44:58
阅读次数:
266
??
任何一个STL算法,都需要获得由一对迭代器(泛型指针)所标识的区间,用以表示操作范围。这一对迭代器所标示的是个所谓的前闭后开区间,以[first,last)表示。也就是说,整个实际范围从first开始,知道last-1。迭代器last所指的是“最后一个元素的下一位置”。这种偏移一格的标示法,带来了许多方便,例如下面两个STL算法的循环设计,就显得干净利落:
template
...
分类:
其他好文 时间:
2014-06-21 21:20:27
阅读次数:
293