一天一道LeetCode系列(一)题目
Implement strStr().
Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
(二)解题第一种解法:朴素匹配算法
/*两个指针,分别指向两个字符串的首字符如果相等则一起向后移...
分类:
其他好文 时间:
2016-04-26 20:27:06
阅读次数:
143
Implement a basic calculator to evaluate a simple expression string. The expression string contains only non-negative integers, +, -, *, / operators a ...
分类:
其他好文 时间:
2016-04-26 14:19:11
阅读次数:
94
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-04-26 14:05:11
阅读次数:
128
一、OC简介 在C语言的基础上,增加了一层最小的面向对象语法;完全兼容C语言;可以在OC代码中混入C语言代码,甚至是C++代码;可以使用OC开发Mac OS X平台和iOS平台的应用程序。 二、OC语法预览 (一)关键字 基本上所有的关键字都是以@开头的,如@interface @implement ...
分类:
其他好文 时间:
2016-04-25 09:11:55
阅读次数:
163
题目: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 fr ...
分类:
其他好文 时间:
2016-04-23 23:01:33
阅读次数:
189
项目开发中字符串模型建立
strstr的while dowhile模型
//int cltClient_rev(void *handle, unsigned char *buf, int *buflen)
//不要相信别人给你传送的内存地址是可用的
int getCout(char *str, char *substr, int *count)
{...
分类:
编程语言 时间:
2016-04-22 20:42:06
阅读次数:
241
今天我们来模拟实现strstr这个函数,首先我们先来了解一下这个函数,这个函数原型为char*strstr(char*str1,char*str2),功能是:从字符串str1中查找是否有符串str2,若str2是str1的子串,则先确定str2在str1的第一次出现的位置,并返回此str1在str2首位置的地址,如果str2不是s..
分类:
其他好文 时间:
2016-04-21 18:42:13
阅读次数:
125
Implement a trie with insert, search, and startsWith methods. Note:You may assume that all inputs are consist of lowercase letters a-z. ...
分类:
其他好文 时间:
2016-04-21 15:15:59
阅读次数:
113
要模拟库函数的实现,必须要搞清楚的是在程序调用中它的实现原理是什么,接下来就讲解几个字符串相关的函数,比如strcmp(),strncmp(),strcat(),strncat()......字符串函数主要包括受限制字符串函数与不受限制字符串函数,那么什么是受限制字符串函数与不受限制字符..
分类:
其他好文 时间:
2016-04-21 13:50:57
阅读次数:
257
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return the n ...
分类:
其他好文 时间:
2016-04-21 13:31:58
阅读次数:
174