码迷,mamicode.com
首页 >  
搜索关键字:return    ( 60766个结果
校验是否为手机号码
/** * 校验是否为手机号码 * @param string $mobile* @return boolean */function is_mobile($mobile) { if(preg_match('#^13[\d]{9}$|14^[0-9]\d{8}|^15[0-9]\d{8}$...
分类:移动开发   时间:2015-07-15 16:55:24    阅读次数:129
iOS:Block写递归
首先来一个 oc 的递归:- (int)sum:(int)num { if (num == 0) { return num; } return num + [self sum:num - 1];}写递归算法只需要记住两点即可:1. 有一个明确的出口2. 不满足条件出口...
分类:移动开发   时间:2015-07-15 16:40:52    阅读次数:133
7.Reverse Integer (INT; Overflow)
Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321思路:要注意溢出。用以下做法,会溢出。class Solution {public: int reverse(in...
分类:其他好文   时间:2015-07-15 16:40:17    阅读次数:83
预防SQL注入攻击
/** * 预防SQL注入攻击 * @param string $value* @return string */function check_input($value){ // 去除斜杠 if (get_magic_quotes_gpc()) { $value = strip...
分类:数据库   时间:2015-07-15 16:28:22    阅读次数:142
生成随机验证码
/** * 生成随机验证码 * @param string $len 验证码长度 * @return string **/function GetRandStr($len) { $chars = array( "0", "1", "2", "3", "4", "5", "...
分类:其他好文   时间:2015-07-15 16:27:32    阅读次数:112
leetCode 56.Merge Intervals (合并区间) 解题思路和方法
Merge Intervals  Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,18]. 思路:题意很明确,首先对各区间按开始来排序,最后遍历,如...
分类:其他好文   时间:2015-07-15 15:09:46    阅读次数:190
leetCode 58.Length of Last Word (最后单词的长度) 解题思路和方法
Length of Last Word  Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word does not exist, return...
分类:其他好文   时间:2015-07-15 15:08:18    阅读次数:97
leetCode 59.Spiral Matrix II (螺旋矩阵II) 解题思路和方法
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 following matrix: [  [ 1, 2, 3 ],  [ 8, 9, 4 ]...
分类:其他好文   时间:2015-07-15 15:08:07    阅读次数:253
leetCode 61.Rotate List (旋转链表) 解题思路和方法
Rotate List  Given a list, rotate the list to the right by k places, where k is non-negative. For example: Given 1->2->3->4->5->NULL and k = 2, return 4->5->1->2->3->NULL. 思路:题目很清晰,思路是先得到...
分类:其他好文   时间:2015-07-15 15:06:27    阅读次数:122
我的 C++ style
1 int g_tennis; // not use as possible 2 3 int make_world() { 4 int size = 0; 5 6 return size; 7 } 8 9 const int NUMBER = 100;10 11 enu...
分类:编程语言   时间:2015-07-15 15:01:15    阅读次数:146
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!