码迷,mamicode.com
首页 >  
搜索关键字:return    ( 60766个结果
shell脚本解析6----case语句
BASH中的case结构,可以用于进行多项分支。case "$var" incondition1) ;;condition2) ;;*) default statments;;esac例如:#!/bin/bashecho "Hit a key, then hit return"read...
分类:其他好文   时间:2014-07-11 10:44:58    阅读次数:230
去掉有序数组中重复数字 原地 leetcode java (最简单的方法)
1.利用荷兰国旗的思路,每次记住最后一个位置,遇到一个不重复的数,放在它后面,代码很简单。Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the...
分类:编程语言   时间:2014-07-11 09:42:49    阅读次数:238
【LeetCode】Search Insert Position (2 solutions)
Search Insert PositionGiven a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if ...
分类:其他好文   时间:2014-07-11 09:09:33    阅读次数:211
【剑指offer】打印1到最大的n位数
题目描述:        输入数字n,按顺序打印出从1到最大的n位十进制数。比如输入3,则打印出1、2、3一直到最大的3位数即999。 分析描述:        首先想到的是先计算出最大的n位数是多少,然后用一个循环从1开始打印直到最大的n位数。 void Print1ToMaxOfNDigits_1(int n) { if(n <= 0) return;...
分类:其他好文   时间:2014-07-10 23:21:17    阅读次数:184
python 3Des 加密
import hashlib; from Crypto.Cipher import DES3 import base64 def create_key(sk):     r=hashlib.md5(sk).digest()     return r+r[:8] def init_str(s):     l=len(s) % 16     if l!=0:         ...
分类:编程语言   时间:2014-07-10 21:41:26    阅读次数:1376
leetcode - interleaving string
题目描述: Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example, Given: s1 = "aabcc", s2 = "dbbca", When s3 = "aadbbcbcac", return true. When s3 = "aad...
分类:其他好文   时间:2014-07-10 21:15:16    阅读次数:166
python使用multiprocessing进行多进程编程(1)
multiprocessing模块实现了对多进程编程的封装,让我们可以非常方便的使用多进程进行编程。它的使用方法非常类似threading模块。 1.创建一个进程 import multiprocessing def worker(): """worker function""" print 'Worker' return if __name__ == '_...
分类:编程语言   时间:2014-07-10 17:10:01    阅读次数:216
小算法:求一个数的乘方 - 使用递归
小算法:求一个数的乘方 - 使用递归 1 /** 2 * 求一个整数的乘方 3 * @param num 要乘方的数字 4 * @param power 多少次方 5 * @return 6 */ 7 public static int po...
分类:其他好文   时间:2014-07-10 17:00:14    阅读次数:247
将一个字符串重复自身N次
function repeat(target,n){ return Array.prototype.join.call({length: n + 1} , target); }repeat('str',2);//输出strstr
分类:其他好文   时间:2014-07-10 16:39:06    阅读次数:185
返回数组中最小/大值,适用数组
//返回数组中的最小值function min(target){ return Math.min.apply(0,target); }//返回数组中的最大值 function max(target){ return Math.max.apply(0,target); ...
分类:其他好文   时间:2014-07-10 16:29:52    阅读次数:163
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!