码迷,mamicode.com
首页 >  
搜索关键字:implement strstr    ( 2381个结果
(leetcode) Implement strStr()
(1)传统的字符串匹配算法:注意这道题中各种特殊情况的返回值。传统字符串匹配就是让目标字符串从第一个字母开始逐个匹配源字符串的每一个字符,直到匹配完全。class Solution {public: int strStr(string haystack, string needle) { ...
分类:其他好文   时间:2015-06-01 18:26:18    阅读次数:112
LeetCode Implement Trie (Prefix Tree)
Implement a trie with insert, search, and startsWith methods.Note:You may assume that all inputs are consist of lowercase letters a-z.思路分析:这题主要考察Trie 即前缀树的实现,Trie可以用于字典的压缩存储,可以节省空间,但是不节省时间(和HashSet相比)...
分类:其他好文   时间:2015-05-31 14:05:08    阅读次数:178
Single Number II -- leetcode
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 without usi...
分类:其他好文   时间:2015-05-31 12:31:13    阅读次数:118
Runtime Complexity of .NET Generic Collection
Runtime Complexity of .NET Generic CollectionI had to implement some data structures for my computational geometry class. Deciding whether to implemen...
分类:Web程序   时间:2015-05-31 06:47:30    阅读次数:228
【UFLDL】Exercise: Convolutional Neural Network
这个exercise需要完成cnn中的forward pass,cost,error和gradient的计算。需要弄清楚每一层的以上四个步骤的原理,并且要充分利用matlab的矩阵运算。大概把过程总结了一下如下图所示:STEP 1:Implement CNN ObjectiveSTEP 1a: Fo...
分类:Web程序   时间:2015-05-30 12:03:11    阅读次数:220
【leetcode】Sqrt(x)
Implement int sqrt(int x).Compute and return the square root of x. 1 class Solution { 2 public: 3 int mySqrt(int x) { 4 unsigned long long...
分类:其他好文   时间:2015-05-29 20:05:20    阅读次数:114
leetcode | Next Permutation
问题Next Permutation:https://leetcode.com/problems/next-permutation/Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement...
分类:其他好文   时间:2015-05-29 18:18:23    阅读次数:118
Single Number -- 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 using ext...
分类:其他好文   时间:2015-05-29 18:16:19    阅读次数:142
Implement Trie (Prefix Tree)
Implement Trie (Prefix Tree)问题:Implement a trie withinsert,search, andstartsWithmethods.思路: 前缀树我的代码:class TrieNode { // Initialize your data struc...
分类:其他好文   时间:2015-05-29 17:42:12    阅读次数:114
【Pow(x,n)】
题目:Implement pow(x,n).代码:class Solution {public: double myPow(double x, int n) { double ret = Solution::positivePow(fabs(x), ...
分类:其他好文   时间:2015-05-29 13:27:57    阅读次数:94
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!