Two Sum I Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input wou ...
分类:
其他好文 时间:
2016-04-03 23:46:26
阅读次数:
244
PathUtil.getClasspathFile("test.txt")//这样就可以查找importjava.io.File;importjava.io.IOException;importjava.io.InputStream;importjava.net.URL;publicenumPathUtil{INSTANCE;privatestaticStringwebRootPath;/***指定类的编译路径*@paramclazz*@return*/@SuppressWarn..
分类:
编程语言 时间:
2016-04-03 20:39:22
阅读次数:
304
getter & setter 在 Swift 中 getter & setter 很少用,以下代码仅供了解 private var _name: String? var name: String? { get { return _name } set { _name = newValue } } ...
分类:
编程语言 时间:
2016-04-03 20:21:56
阅读次数:
123
Given a string s, cut s into some substrings such that every substring is a palindrome. Return the minimum cuts needed for a palindrome partitioning o ...
分类:
其他好文 时间:
2016-04-03 20:10:22
阅读次数:
103
获取一个函数的所有参数 1 2 3 4 5 6 7 8 9 10 11 12 13 14 function foo() { $numargs = func_num_args(); //参数数量 echo "参数个数是: $numargs<br />\n"; if ($numargs >= 2) { ...
分类:
其他好文 时间:
2016-04-03 20:09:40
阅读次数:
196
递归函数中,位于递归调用语句后的语句的执行顺序和各个被调用函数的顺序相反; 下面看一个经典的例子: #include<stdio.h> void up_and_down(int); int main(void) { up_and_down(1); return 0; } void up_and_do ...
分类:
其他好文 时间:
2016-04-03 14:32:20
阅读次数:
192
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return all ...
分类:
其他好文 时间:
2016-04-03 14:28:26
阅读次数:
162
原题链接在这里:http://www.lintcode.com/en/problem/longest-common-substring/# 题目: Given two strings, find the longest common substring. Return the length of i ...
分类:
其他好文 时间:
2016-04-03 14:27:29
阅读次数:
225
如果方法不包含参数,但有返回值,我们称为无参带返回值的方法。 例如:下面的代码,定义了一个方法名为 calSum ,无参数,但返回值为 int 类型的方法,执行的操作为计算两数之和,并返回结果 在 calSum( ) 方法中,返回值类型为 int 类型,因此在方法体中必须使用 return 返回一个 ...
分类:
编程语言 时间:
2016-04-03 11:49:41
阅读次数:
530
#include<stdio.h> int add(int a,int b) { if(b==0) return a; int sum,ret; sum=a^b; ret=(a & b)<<1; return add(sum,ret); } void main() { int a=4; int b= ...
分类:
其他好文 时间:
2016-04-03 11:46:37
阅读次数:
141