码迷,mamicode.com
首页 >  
搜索关键字:implement strstr    ( 2381个结果
【LeetCode】Implement strStr()
Implement strStr()Implement strStr().Returns a pointer to the first occurrence of needle in haystack, ornullif needle is not part of haystack.标准KMP算法。...
分类:其他好文   时间:2014-05-27 23:41:07    阅读次数:366
餐厅电子管理系统
CP2011 Assignment Details, SP1 2014Imagine that you are programmer for a small independent software company. You have been given the task of implement...
分类:其他好文   时间:2014-05-26 17:30:15    阅读次数:349
数据结构——算法之(012)( linux C 所有字符串操作函数实现)
题目:实现linux C下常用的字符串操作函数 题目分析: 一、面试中可能经常遇到这样的问题:比如strcpy、memcpy、strstr 二、参考了linux 内核代码,对linux大神表示感谢,代码写得相当精致,这里拿来与大家分享吧 算法实现: /* * linux/lib/string.c * * Copyright (C) 1991, 1992 Lin...
分类:系统相关   时间:2014-05-26 05:21:03    阅读次数:474
LeetCode: Pow(x, n) [049]
【题目】 Implement pow(x, n). 【题意】 实现pow(x, n) 【思路】 最直接的思路是用一个循环,乘n次的x。 当n的值较小的时候还好,当n非常大时,时间成本就非常高。加入n=INT_MAX, 也就是21亿多次循环,你可以试想一下。 在这种情况下,我们需要快速的乘完n个x,采用尝试贪心的方法,即滚雪球方式的翻倍相乘 注意:几种特殊情况 1. n=0; 2. n<0;...
分类:其他好文   时间:2014-05-26 04:37:31    阅读次数:212
PHP 字符串获取 substr 与 strstr 函数-来自PHP教程
PHP 字符串获取 substr 与 strstr 函数PHP 字符串获取用于从字符串中获取指定字符串。相关函数如下:substr():从字符串中获取其中的一部分strstr():查找字符串在另一个字符串中第一次出现的位置,并返回从该位置到字符串结尾的所有字符subchr():同 strstr()s...
分类:Web程序   时间:2014-05-26 00:31:24    阅读次数:377
【LeetCode】Single Number
原文: 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-05-25 21:30:02    阅读次数:276
短语搜索
短语搜索 时间限制(普通/Java):1000MS/3000MS          运行内存限制:65536KByte 总提交:535            测试通过:170 描述 常见文本编辑器的一个功能是搜索,打开一段英文文字,根据一个给定的英文短语,可以搜索得到这个短语在文章中的位置,短语有可能重复出现。现请求出给定的短语在一段文字中出现的最后一个位置。文字中单词从1开始编号,所...
分类:其他好文   时间:2014-05-25 01:06:22    阅读次数:284
【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-05-23 09:59:05    阅读次数:257
LeetCode: Wildcard Matching [043]
【题目】 Implement wildcard pattern matching with support for '?' and '*'. '?' Matches any single character. '*' Matches any sequence of characters (including the empty sequence). The matching should cover the entire input string (not partial). The functi...
分类:其他好文   时间:2014-05-23 00:17:12    阅读次数:364
18.用两个栈实现队列
2 stacks to implement a queue.
分类:其他好文   时间:2014-05-22 02:25:01    阅读次数:230
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!