4.1 Implement a function to check if a binary tree is balanced. For the purposes of this question, a balanced tree is defined to be a tree such that t...
分类:
其他好文 时间:
2015-07-29 13:46:49
阅读次数:
99
1.题目:Implement a basic calculator to evaluate a simple expression string.The expression string may contain open(and closing parentheses), the plus+or ...
分类:
其他好文 时间:
2015-07-28 22:39:08
阅读次数:
119
链接:http://oj.leetcode.com/problems/lru-cache/
参考:http://www.acmerblog.com/leetcode-lru-cache-lru-5745.html
Design and implement a data structure for Least Recently Used (LRU) cache. It shoul...
分类:
系统相关 时间:
2015-07-28 18:36:30
阅读次数:
174
0x01 TLS使用中的降级To work with legacy servers, many TLS clients implement a downgrade dance: in a first handshake attempt, offer the highest protocol vers...
分类:
其他好文 时间:
2015-07-28 17:36:11
阅读次数:
196
最近写了一个三子棋的游戏,然后我们来看一下。主函数:intmain()
{
intstart=1;
charlchess=0;
charcchess=0;
charchess[5][11];
while(start)
{
intn=1;
intp=1;
start=1;
printf("---------------开始游戏-------------\n");
for(cchess=0;cchess<5;cchess++)..
分类:
其他好文 时间:
2015-07-28 06:54:29
阅读次数:
197
【050-Implement pow(x, n)(求x的n次方)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Implement pow(x, n).
题目大意 求x的n次方。
解题思路 递归求解。
代码实现算法实现类public class Solution { public double myPow(double x, int n) {...
分类:
编程语言 时间:
2015-07-28 06:43:24
阅读次数:
166
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get the valu...
分类:
系统相关 时间:
2015-07-28 06:39:22
阅读次数:
168
1.题目:Implement a basic calculator to evaluate a simple expression string.The expression string may contain open(and closing parentheses), the plus+or ...
分类:
其他好文 时间:
2015-07-28 00:26:48
阅读次数:
142
Sqrt(x)
Implement int sqrt(int x).
Compute and return the square root of x.
解题思路:
这道题是求x的平方根。
解法1:基本的想法就是枚举,从1到n进行遍历,直到result*result>x,那么结果就是result-1。
class Solution {
public:
int...
分类:
其他好文 时间:
2015-07-27 23:08:04
阅读次数:
160
字典树。
测试中有:aaaaaaaaaaa... 的输入,如果每个节点用定长数组存储孩子的话,那就是26^len的空间复杂度(len为输入的长度),内存会不够的。
所以用map保存其孩子。
代码:
#include
#include
#include
using namespace std;
class TrieNode
{
public:
// Initialize ...
分类:
其他好文 时间:
2015-07-27 21:05:26
阅读次数:
103