class Solution {public: bool isMatch(const char *s, const char *p) { if (s == NULL || p == NULL) return false; int slen = 0; i...
分类:
其他好文 时间:
2014-07-27 10:41:42
阅读次数:
225
Implement int sqrt(int x).Compute and return the square root of x.线性查找会TLE。用二分查找。注意溢出的处理。全部都改成long long. 1 class Solution { 2 public: 3 int sqrt(i...
分类:
其他好文 时间:
2014-07-27 10:41:02
阅读次数:
181
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example, Given n = 3,You should return the followin...
分类:
其他好文 时间:
2014-07-27 10:21:02
阅读次数:
219
上篇说到通过result.class.php来分流,因为三个类都继承了shape这个类,让我们来看一下,面向对象中的继承。shape.class.shape文件'.$message.'必须为非负值的数>字,而且不能为空'; return false...
分类:
Web程序 时间:
2014-07-27 10:20:12
阅读次数:
234
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example, Given the following matrix:[ [ 1,...
分类:
其他好文 时间:
2014-07-27 10:16:02
阅读次数:
135
先上个效果图:在关于页面时,在点击邻居管理后,实现所在页面的提示,相当于文字导航。实现方法:js: 1 var a,b; 2 function admin_op(a,b){ 3 if(b==0){ 4 history.go(0) 5 return tr...
分类:
其他好文 时间:
2014-07-27 10:03:52
阅读次数:
207
public static string HtmlEncode(string theString){theString = theString.Replace(">", ">");theString = theString.Replace(" ");return theString;}第一段是...
分类:
Web程序 时间:
2014-07-27 09:55:52
阅读次数:
236
function getByClass( className, context) { var context = context || document; if( context.getElementsByClassName) { return context.getEle...
分类:
Web程序 时间:
2014-07-26 16:51:42
阅读次数:
207
其实递归放到其他编程语言里面可能是初学函数的一个练习题,但是由于PHP的特殊性,我们把它拿出来专门讲解一下,首先说一下什么是递归把,我最早认识递归是求一个数的阶乘,比如我们写一个函数,然后求它的阶乘是多少。
看下面的PHP代码:
0){
return $n *xin($n -1 );
}else...
分类:
Web程序 时间:
2014-07-26 15:31:19
阅读次数:
229
class Solution {
public:
const int MAXVALUE = 1 << 30;
int findMinStepToIndex(int maxNumbers[],int maxSteps,int index)
{
if (index == 0)
return 0;
int left = 1;
int right = maxSteps;...
分类:
其他好文 时间:
2014-07-26 15:30:01
阅读次数:
170