码迷,mamicode.com
首页 >  
搜索关键字:return    ( 60766个结果
[LintCode] O(1)检测2的幂次
1 class Solution { 2 public: 3 /* 4 * @param n: An integer 5 * @return: True or false 6 */ 7 bool checkPowerOf2(int n) { 8 ...
分类:其他好文   时间:2015-07-01 08:33:17    阅读次数:348
华为 2015 笔试题练习
1.2015 华为(1):#include #include #include #include int cmp(const void *a, const void *b){ return *(int*)a - *(int*)b;}int main(){ char strIn[4096] = {'\...
分类:其他好文   时间:2015-06-30 23:25:25    阅读次数:171
Python学习十四:filter()
Python 中内置了filter()函数用于过滤序列。 用法: filter()接收一个函数和一个序列。filter()把传入的函数依次作用于每个元素,然后根据返回值是True还是False决定保留还是丢弃该元素。demo: 1、在一个list中,删掉偶数,只保留奇数:#filter odd number in the list def is_odd(n): return n % 2...
分类:编程语言   时间:2015-06-30 22:00:09    阅读次数:132
Leetcode 228 Summary Ranges
Given a sorted integer array without duplicates, return the summary of its ranges.For example, given[0,1,2,4,5,7], return["0->2","4->5","7"].类似于 Leetc...
分类:其他好文   时间:2015-06-30 21:56:07    阅读次数:103
LeetCode:Merge Two Sorted Lists
Title:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.htt...
分类:其他好文   时间:2015-06-30 21:41:43    阅读次数:101
[LeetCode] Summary Ranges
Given a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"].解题思路略实现代码C++:// Runtime: 0 ms class Solution { public:...
分类:其他好文   时间:2015-06-30 20:27:06    阅读次数:124
由浅拷贝讨论到深拷贝再讨论到接口(一):浅拷贝和深拷贝
接口ICloneable为我们实现了拷贝的梦想。(一)如何实现浅拷贝?新建学校对象(School),实现接口ICloneable,如果我们这样写,即完成了浅拷贝:return base.MemberwiseClone();Code highlighting produced by Actipro C...
分类:其他好文   时间:2015-06-30 20:13:05    阅读次数:191
字符串异或加密
/*** 字符串异或加密** @param oldStr 被加密的字符串* @param x 字符偏移量** @return 加密后的字符串*/- (NSString *)getCharArrayUsingString:(NSString *)oldstr withCharOffset:(int.....
分类:其他好文   时间:2015-06-30 20:01:20    阅读次数:117
【C语言】求两个数中不同的位的个数
//求两个数中不同的位的个数 #include int count_different(int a, int b) { int count = 0; int c = a^b; //a,b中不同的位即为1 while (c) { count++; c = c&(c - 1); //把c中最后一个1去掉 } return count; } int main() {...
分类:编程语言   时间:2015-06-30 18:34:49    阅读次数:111
命令行参数
///回送命令/// #include using namespace std; int main(int argc,char *argv[]) { int i=1; while(i<argc){ cout<<argv[i++]<<' '<<endl; } return 0; }...
分类:其他好文   时间:2015-06-30 18:31:09    阅读次数:87
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!