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-01-15 11:03:15
阅读次数:
157
# -*- coding: utf8 -*-'''https://oj.leetcode.com/problems/regular-expression-matching/Implement regular expression matching with support for '.' and '...
分类:
编程语言 时间:
2015-01-15 00:11:02
阅读次数:
215
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-01-14 23:01:20
阅读次数:
402
Implement pow(x,n).分析:分治法。代码如下:class Solution {public: double pow(double x, int n) { if(n < 0) return 1.0/power(x, -n); return power(...
分类:
其他好文 时间:
2015-01-14 22:34:51
阅读次数:
137
题目:
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 next smallest number in the BST.
Note:...
分类:
编程语言 时间:
2015-01-14 18:01:28
阅读次数:
182
# -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com'https://oj.leetcode.com/problems/string-to-integer-atoi/Implement atoi to convert a string...
分类:
其他好文 时间:
2015-01-14 00:36:59
阅读次数:
143
在一个较长的字符串这查找匹配的字符串或字符,其中strstr()和strchr()是完全一样的。例:echo strstr('why always you','you');输出:you如果为:echo strstr('why always you','you');则无输出stristr()函数对大小...
分类:
其他好文 时间:
2015-01-13 21:23:02
阅读次数:
173
Implement int sqrt(int x).
Compute and return the square root of x.
二分查找法:
class Solution {
public:
int sqrt(int x)
{
int high = INT_MAX;
int low = 0;
while(low...
分类:
其他好文 时间:
2015-01-12 17:41:51
阅读次数:
138
一、 基于PHP实现的webshell攻击
二、 不用或少用else语句
三、 单页面结构(Single-page application)
四、 让搜索引擎抓取ajax的内容
五、 CURL_MULTI_INIT()
六、 PHP strstr()函数
七、 论规范化的重要性
八、 HHVM
九、 PHP源码签名收集器
十、 协同过滤推荐算法...
分类:
Web程序 时间:
2015-01-12 17:35:43
阅读次数:
256
Pow(x, n)Implement pow(x,n).思路:分治算法,2^4=(2^2)*(2^2)。整体的思路就是这样,要注意考虑n为负数的情况。我的做法是在写一个函数计算乘方,原来的函数根据n的正负选择如何调用power函数。开始的时候,没有用tmp保存power(x,n/2)的值,直接写成p...
分类:
其他好文 时间:
2015-01-12 14:17:00
阅读次数:
229