题目:Implement wildcard pattern matching with support for '?' and '*'.'?' Matches any single character.'*' Matches any sequence of characters (includin....
分类:
编程语言 时间:
2014-08-06 04:10:50
阅读次数:
325
Problem Description:
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
If such arrangement is not possible, it must rea...
分类:
其他好文 时间:
2014-08-05 22:40:40
阅读次数:
241
//(2^n-1)%mod
//费马小定理:a^n ≡ a^(n%(m-1)) * a^(m-1)≡ a^(n%(m-1)) (mod m)
# include
# include
# include
# define mod 1000000007
using namespace std;
__int64 pow(__int64 n)
{
__int64 p=1,q=2;
w...
分类:
其他好文 时间:
2014-08-05 22:40:30
阅读次数:
242
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 u...
分类:
其他好文 时间:
2014-08-05 22:35:00
阅读次数:
277
Implement pow(x, n).
思路:快速幂运算,需要考虑指数为负数,同时底数为0的情况,这种属于异常数据,代码里没有体现。
class Solution {
public:
double pow_abs(double x, unsigned int n)
{
if (n == 0)
{
return 1;...
分类:
其他好文 时间:
2014-08-04 21:32:48
阅读次数:
314
【题目】Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get the ...
分类:
其他好文 时间:
2014-08-04 21:10:27
阅读次数:
218
1、pow函数
#include
pow(x,y)用来计算以x 为底的 y 次方值,然后将结果返回。
注意:pow函数返回值为double型
printf ("32.01 ^ 1.54 = %f\n", pow (32.01, 1.54) );
(他也可以计算小数的小数次方)
2、动态规划:
动态规划过程是:每次决策依赖于当前状态,...
分类:
其他好文 时间:
2014-08-04 17:52:40
阅读次数:
206
The Code
In this lab you will implement a streaming video server and client that communicate using the Real-Time Streaming Protocol (RTSP) and send data using the Real-time Transfer Protocol (RTP). Y...
分类:
其他好文 时间:
2014-08-04 11:06:37
阅读次数:
413
Java的继承是通过extends和implement来实现的,Java不支持多继承,但是Java支持多层继承以及多实现(接口)。Java继承有一个关键字super是用来指向父类。Java继承衍生出覆盖的概念。覆盖被用来支持多态。实际开发中Java通常继承于抽象类,实现于接口。如果不希望一个类被继承...
分类:
编程语言 时间:
2014-08-02 20:44:13
阅读次数:
219
Single Number II
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 using extra memory?...
分类:
其他好文 时间:
2014-08-02 12:53:53
阅读次数:
289