1、break
直接跳出当前的循环,从当前循环外面开始执行,忽略循环体中任何其他语句和循环条件测试。它只能跳出一层循环,如果循环是嵌套循环,那么需要按照你嵌套的层次,逐步使用break来跳出;2、
continue 也是终止当前的循环过程,但它他并不跳出循环,而是继续往下判断循环条件执行语句。...
分类:
其他好文 时间:
2014-05-23 06:49:30
阅读次数:
228
Given a sorted array, remove the duplicates in
place such that each element appear onlyonceand return the new length.Do not
allocate extra space for a...
分类:
其他好文 时间:
2014-05-21 20:00:51
阅读次数:
296
desc)) { $loc =
$location->province.$location->city.$location->district.$location->isp;
}else{ $loc = $location->desc; } return $loc;}ec...
分类:
Web程序 时间:
2014-05-21 19:41:19
阅读次数:
364
【题目】
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 should run in O(n) time and uses constant space.
【题意】
给定一个数组,找出第一个缺失的正数。时间复杂度O(n)
...
分类:
其他好文 时间:
2014-05-21 17:13:07
阅读次数:
219
#include
#include
using namespace std;
class Point
{
public:
Point(double a,double b):x(a),y(b) {}
double getx()
{
return x;
}
double gety()
{
...
分类:
其他好文 时间:
2014-05-21 14:44:07
阅读次数:
281
【题目】
Given two numbers represented as strings, return multiplication of the numbers as a string.
Note: The numbers can be arbitrarily large and are non-negative.
【题意】
给定用字符串表示的整数,返回两个数的乘积结果字符串。两个数字都非负,且能任意大。
【思路】
1. 考虑其中一个数是0的情况
2. 模拟乘法运算...
分类:
其他好文 时间:
2014-05-21 13:45:37
阅读次数:
214
shell命令分成内置命令和外部命令。
内置命令(builtin command) 是shell解释程序内建的,有shell直接执行,不需要派生新的进程。有一些内部命令可以用来改变当前的shell环境。
常见的内部命令有:.(点命令)、bg、cd、continue、echo、exec、exit、export、fg、jobs、pwd、read、return、set、shift、t...
分类:
其他好文 时间:
2014-05-21 13:33:24
阅读次数:
213
public class ArrayUtils{
/**
* 返回数组最大值
*
* @param a
* @return
*/
public static int max(int[] a){
// 返回数组最大值
int x;
int aa[]=new int[a.leng...
分类:
编程语言 时间:
2014-05-21 13:31:26
阅读次数:
373
#include
#include
using namespace std;
class Point
{
public:
Point(double a,double b):x(a),y(b) {}
double getx()
{
return x;
}
double gety()
{
return y;
...
分类:
其他好文 时间:
2014-05-21 10:09:26
阅读次数:
309
题目:
Given an array of integers, find two numbers such that they add up to a specific target number.
The function twoSum should return indices of the two numbers such that they add up t...
分类:
其他好文 时间:
2014-05-21 07:42:18
阅读次数:
230