1. strstr 和 stristr的用法123456strstr: 返回一个从被判断字符开始到结束的字符串,如果没有返回值,则不包含. stristr: 它和strstr的使用方法完全一样.唯一的区别是stristr不区分大小写.$email = ‘ user@example.com’;$dom...
分类:
Web程序 时间:
2015-07-15 10:41:20
阅读次数:
245
题目链接一A,开森~ac代码: 1 class TrieNode { 2 // Initialize your data structure here. 3 char content; 4 boolean isWord; 5 int count; 6 Link...
分类:
其他好文 时间:
2015-07-14 21:59:57
阅读次数:
150
题目: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-07-14 20:26:17
阅读次数:
118
https://leetcode.com/problems/implement-strstr/题目:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle ...
分类:
其他好文 时间:
2015-07-14 15:23:11
阅读次数:
131
LeetCode上面的一道题目,原文如下:
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() -- G...
分类:
其他好文 时间:
2015-07-14 11:23:27
阅读次数:
131
Pow(x, n)
Implement pow(x, n).
思路:题目不算难,但是需要考虑的情况比较多。
具体代码如下:
public class Solution {
public double myPow(double x, int n) {
boolean isMin0 = true;//结果负号
if(x > 0 || (n&1) == ...
分类:
其他好文 时间:
2015-07-13 14:02:42
阅读次数:
105
题目:
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 possible input c...
分类:
其他好文 时间:
2015-07-13 00:53:24
阅读次数:
100
1、strstr函数主要完成在一个字串中寻找另外一个字串 函数实现工程如下:摘自http://baike.baidu.com/link?url=RwrzOxs0w68j02J2uQs5u1A56bENwkGJ7WgvKMs8J7RzL6wEO8HZ7pWc1ZPO8TdjsgoJwXDf1g_SkH...
分类:
其他好文 时间:
2015-07-12 17:23:59
阅读次数:
129
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-07-12 17:06:51
阅读次数:
110
Implement Stack using QueuesImplement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the eleme...
分类:
其他好文 时间:
2015-07-12 12:43:16
阅读次数:
112