码迷,mamicode.com
首页 >  
搜索关键字:implement strstr    ( 2381个结果
【LeetCode】Pow(x, n) (2 solutions)
Pow(x, n)Implement pow(x,n).按照定义做的O(n)肯定是TLE的。利用这个信息:x2n = (xn)2有个主意点,当n为负是,直接取反是不可行的。由于int的表示范围是[2-31, 231-1],当n为INT_MIN时,取反会溢出。因此需要对n==INT_MIN单独考虑。另...
分类:其他好文   时间:2014-12-13 13:26:21    阅读次数:142
LeetCode刷题之一:寻找只出现一次的数字
题目为: Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without...
分类:其他好文   时间:2014-12-12 23:39:44    阅读次数:473
Leetcode-LRU Cache
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get the...
分类:系统相关   时间:2014-12-12 01:11:43    阅读次数:374
Signal & Slot in QT
Try your best to provide an mechanism to implement what you want.1. All happen before compiling-time.1 QObject.connect(sender,SIGNAL(signal()), recive...
分类:其他好文   时间:2014-12-10 20:59:27    阅读次数:350
leetcode------Pow(x, n)(3)
标题Pow(x, n)通过率26.1%难度中等Implement pow(x,n). 以为只是单纯的求xn,习惯了用java里面的math.pow(x,n),所以我认为传进来的值都是比较正常的,谁知道竟然会传n<0的数。。。。。直接泪奔,然后再尝试。。。发现栈溢出,也就是说单纯的递归或者非递归针对....
分类:其他好文   时间:2014-12-10 17:47:13    阅读次数:153
Spring事务使用的一个误区
Spring bean 假设有如下类 public class Service implement IService{ @Transactional(readOnly = false, propagation=Propagation.REQUIRED)    public void methodA(){    .....   methodB()   ...... ...
分类:编程语言   时间:2014-12-09 21:28:23    阅读次数:278
Implement strStr()
Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. int i,j,k; if(needle[0]=='\0') return 0; for(i=0;haysta...
分类:其他好文   时间:2014-12-09 15:48:41    阅读次数:113
【LeetCode 题解】 LRU Cache
设计并实现最近最久未使用(Least Recently Used)缓存。链接:https://oj.leetcode.com/problems/lru-cache/题目描述:Design and implement a data structure for Least Recently Used (...
分类:系统相关   时间:2014-12-09 15:32:34    阅读次数:320
HDU-2054-A == B ?
题目链接http://acm.hdu.edu.cn/showproblem.php?pid=2054这题只要处理小数点后面无效的'0'或'.' strstr()函数是两个字符串 需用“”号代码#include#includechar a[100000],b[100000];void chu_li(....
分类:其他好文   时间:2014-12-08 17:05:22    阅读次数:164
[leetcode]Pow(x, n)
问题描述: Implement pow(x, n). 基本思想: 将求幂转换为求对数的幂 . 如x^n = exp(n*log(x)); 代码: double pow(double x, int n) { //C++ if(x == 0.0) return 0; if(n == 0) return ...
分类:其他好文   时间:2014-12-07 15:05:48    阅读次数:145
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!