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() -- ...
分类:
其他好文 时间:
2016-08-01 06:55:28
阅读次数:
205
题目描述:把字符串转化为整数值原文描述:Implement atoi to convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the pos...
分类:
编程语言 时间:
2016-07-29 22:59:15
阅读次数:
267
Author: Emmanuel Goossaert 翻译 This article is a short guide to implementing an algorithm from a scientific paper. I have implemented many complex algo ...
分类:
其他好文 时间:
2016-07-29 18:32:15
阅读次数:
271
写一个函数,模拟strstr()函数,strstr()函数主要将主串中子串,以及以后的字符全部返回。比如:在abbcdeef中查找bcde,返回bcdeef思想:1.遍历整个长串,然后找到与短串相同的位置,并且记录这个位置2.与短串依次比较,若在后面某个位置不相同了,这时候,将刚记录的长串的位..
分类:
其他好文 时间:
2016-07-23 21:24:35
阅读次数:
163
Regular Expression Matching Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or ...
分类:
其他好文 时间:
2016-07-23 07:28:18
阅读次数:
176
标准trie的结构是 但是这题里面我们不需要freq也不需要hashset,但是为了表示当前节点是不是作为过一个词的结尾,我们设置一个boolean isLeaf。 这么做的理由是,考虑以下两种情况: 1. 假如插入ab,但是要搜索a,就应该返回false,搜prefix就应该返回true 2. 插 ...
分类:
其他好文 时间:
2016-07-22 06:34:54
阅读次数:
169
Given a nested list of integers, implement an iterator to flatten it. Each element is either an integer, or a list -- whose elements may also be integ ...
分类:
其他好文 时间:
2016-07-22 01:09:03
阅读次数:
168
69. Sqrt(x) Implement int sqrt(int x). Compute and return the square root of x. Hide Tags Binary Search Math Hide Similar Problems (M) Pow(x, n) (M) V ...
分类:
其他好文 时间:
2016-07-20 06:29:35
阅读次数:
177
题目:
Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures?
实现一个算法来判断一个字符串中的字符是否唯一(即没有重复).不能使用额外的数据结构。 (即只使用基本的数据结构)
解答:
首先,你...
分类:
编程语言 时间:
2016-07-19 15:37:10
阅读次数:
200
An interface for the units of computation which can be composed into a Net.
Layer&s must implement a Forward function, in which they take their input (bottom) Blob&s (if any) and compute their outp...
分类:
其他好文 时间:
2016-07-19 10:36:49
阅读次数:
221