码迷,mamicode.com
首页 >  
搜索关键字:implement pow    ( 4537个结果
【leetcode】LRU Cache
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get the valu...
分类:其他好文   时间:2014-08-20 14:04:32    阅读次数:250
异或交换两个数;实现pow(int x, int y) ,即x的y次方
问题1:异或交换两个数假设x=2;y=3,我们的目标是(没有蛀牙!!)交换x,y的值;利用异或的特殊性:x^x=0即两个相同数字异或后值为0;解决:令x=x^y=2^3令y=x^y=x^y^y=2^3^3=2(此时x=x^y)令x=x^y=x^y^2=2^3^2=3(此时x=x^y;y=2)问题2:...
分类:其他好文   时间:2014-08-18 21:55:02    阅读次数:214
leetcode之通配符
Wildcard Matching Implement wildcard pattern matching with support for '?' and '*'. '?' Matches any single character. '*' Matches any sequence of characters (including the empty sequen...
分类:其他好文   时间:2014-08-18 18:34:13    阅读次数:214
Javascript Array 非常用方法解析
1. mapvar ary = Array(3);ary[0] = 2ary.map(function(elem) { return '1'; });结果是["1", undefined * 2], 因为map只能被初始化过的数组成员调用2. reduce[].reduce(Math.pow); ....
分类:编程语言   时间:2014-08-18 15:57:52    阅读次数:185
如何获取android手机联系人并按字母展示(二)
下面写怎么让每个首字母相同的联系人归类展示: 在adapter implement SectionIndexer 这样adapter里必须实现以下3个接口: @Override public Object[] getSections() { //section的集合 } @Override public int getPositionForSection(int...
分类:移动开发   时间:2014-08-18 08:05:03    阅读次数:345
BulkLoop例程の初始化函数and重复调度函数の解析
//----------------------------------------------------------------------------- // File: bulkloop.c // Contents: Hooks required to implement USB perip...
分类:其他好文   时间:2014-08-16 09:36:50    阅读次数:254
[LeetCode]wildcard matching通配符实现TLE
leetcode这道题还挺有意思的,实现通配符,'?'匹配任意字符,'*'匹配任意长度字符串,晚上尝试了一下,题目如下:Implement wildcard pattern matching with support for'?'and'*'.'?' Matches any single chara...
分类:其他好文   时间:2014-08-16 01:01:59    阅读次数:351
js精度(摘)
Math.formatFloat = function (f, digit) { var m = Math.pow(10, digit); return parseInt(f * m, 10) / m;} 摘自 http://www.cnblogs.com/fumj/archive/2012/12/...
分类:Web程序   时间:2014-08-15 19:36:09    阅读次数:250
【Leetcode长征系列】Single Number II
原题: Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it withou...
分类:其他好文   时间:2014-08-15 14:46:48    阅读次数:207
leetcode -- Implement strStr()
反正总是有人要赢,那为什么不能是我呢~[问题描述]Implement strStr().Returns a pointer to the first occurrence of needle in haystack, ornullif needle is not part of haystack.[...
分类:其他好文   时间:2014-08-15 14:14:58    阅读次数:197
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!