码迷,mamicode.com
首页 >  
搜索关键字:implement strstr    ( 2381个结果
*Binary Search Tree Iterator
题目:Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Callingnext()will return the n...
分类:其他好文   时间:2015-08-10 07:04:35    阅读次数:119
Leetcode: Sqrt(x)
Implement int sqrt(int x). Compute and return the square root of x. 1. 二分法: 用unsigned long long。最后返回值还要再检查一下。 class Solution { public: int mySqrt(int x) { unsigned long long be...
分类:其他好文   时间:2015-08-09 18:50:31    阅读次数:179
LeetCode:Pow(x, n)
1、题目名称 Pow(x, n)(求指定数字x的整数次幂) 2、题目地址 https://leetcode.com/problems/powx-n/ 3、题目内容 英文:Implement pow(x, n) 中文:给定底数x和指数n,求x的n次幂 4、解题方法1 在Java中,有一...
分类:其他好文   时间:2015-08-08 21:31:57    阅读次数:140
[leetcode 234]Implement Queue using Stacks
Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front of queue.peek() -- Get the front element.empty(...
分类:其他好文   时间:2015-08-08 21:26:15    阅读次数:94
leetcode_LRU Cache_easy-缓存相关
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 value (will always be positive) of the key if ...
分类:系统相关   时间:2015-08-08 21:25:18    阅读次数:261
STL
字符串处理的题可能有一些可以直接用到STL里面的函数,会很快很方便,比如cstring里面的strncpy和strstr:char*strncpy(char*dest,char*src,size_tn): 为字符串拼接函数,把src字符串的起始地址加上size长度(偏移量),copy到dest数组....
分类:其他好文   时间:2015-08-08 19:53:35    阅读次数:107
regular expression matching DP
这个题目,我从前天晚上(8月6号晚上)调试到现在(8月8号16:21),太心酸了,不好好总结一下,就太对不起自己了!这是题目:Implement regular expression matching with support for'.'and'*'.'.' Matches any single ...
分类:其他好文   时间:2015-08-08 18:13:54    阅读次数:87
[leedcode 232] Implement Queue using Stacks
Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front o...
分类:其他好文   时间:2015-08-08 17:47:48    阅读次数:134
[leedcode 225] Implement Stack using Queues
Implement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top()...
分类:其他好文   时间:2015-08-08 14:54:53    阅读次数:98
leetcode_Implement Stack using Queues
1.跟用栈实现队列不同,我感觉用队列去实现栈要困难的多,以至于根本就想不起来,参考了网络上的思路才算是有了写头绪,原来是这个这个样子。。。 2.如果用栈来实现队列还算可以理解的话,但用队列来实现栈就只有两个字来形容:no zuo no die!,下面我就来描述下这种奇葩的思路: 3.用两个队列queue1和queue2来模拟栈,具体怎么模拟呢?queue1是操作队列,先进先出,queue2是中转队列,每次取元素时,将0~size-2个元素先中转到queue2中,然后取出queue1的最后一个元素,然后,对,...
分类:其他好文   时间:2015-08-07 11:18:42    阅读次数:110
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!