Question:Compare two version numbersversion1andversion2.Ifversion1>version2return 1, ifversion1i2[i]) return 1; else if(i1[i...
分类:
其他好文 时间:
2015-07-13 23:59:29
阅读次数:
256
Implementint sqrt(int x).Compute and return the square root ofx.public class Solution { //本题利用了牛顿迭代法:设r是f(x) = 0的根(x^2-k=f(x)),选取x0作为r初始近似值,过点(x0,f...
分类:
其他好文 时间:
2015-07-13 23:59:22
阅读次数:
371
先说递归:因为原理简单,但是要用灵活运用的话,是非常困难的。 递归的原理就是在函数内部调用函数自己,以实现循环的目的, 比如一个阶乘函数def fn(n): if n==1: return n; else : return...
分类:
编程语言 时间:
2015-07-13 23:38:08
阅读次数:
238
1、建两个表publish:pub_id 和 images:pub_id,image_path;
2、使用gii的crud生成代码
3、在models内Publish.php内写关联函数public function getImage()
{
return $this->hasOne(Images::className(),['pub_id'=>'pub_id']);...
分类:
其他好文 时间:
2015-07-13 22:30:37
阅读次数:
186
Question:Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ......
分类:
其他好文 时间:
2015-07-13 22:18:59
阅读次数:
103
Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".public class Solution { public String addBin...
分类:
其他好文 时间:
2015-07-13 22:15:12
阅读次数:
114
#include int newcoder(int n){ if (n==0) { return 7; }else if(n==1) { return 11; } else return newcoder(n-1)+newcoder(n-2)...
分类:
其他好文 时间:
2015-07-13 22:15:12
阅读次数:
93
Question:Given an integern, return the number of trailing zeroes inn!.1、题型分类:2、思路:寻找n!后面的0的个数,即有多少个2*5,从而需要寻找里面总共有多少个2和多少个5,2肯定比5多,则只要找出5的个数即可。n/5是从n/...
分类:
其他好文 时间:
2015-07-13 22:12:53
阅读次数:
137
我们知道链接的 onclick 事件被先执行,其次是 href 属性下的动作(页面跳转,或 javascript 伪链接),如果不想执行href 属性下的动作执行,onclick 需要要返回 false ,一般是这样写onclick="xxx();return false;".a标签的应用 1、提....
分类:
其他好文 时间:
2015-07-13 22:08:28
阅读次数:
125
Question:Related to questionExcel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For examp...
分类:
其他好文 时间:
2015-07-13 21:55:04
阅读次数:
113