Link1: Give an example Note: I think the Storable::Write method should also be pure virtual. http://www.cprogramming.com/tutorial/virtual_inheritance. ...
分类:
编程语言 时间:
2016-06-30 21:43:43
阅读次数:
361
Given an integer array of size n, find all elements that appear more than ? n/3 ? times. The algorithm should run in linear time and in O(1) space. Hi ...
分类:
其他好文 时间:
2016-06-30 01:07:28
阅读次数:
177
题目给定一个单链表中的一个等待被删除的节点(非表头或表尾)。请在在O(1)时间复杂度删除该链表节点。解题这个删除结点的方式很好
把需要删除结点的值用后面一个结点值更新
删除后面的那个结点public class Solution {
/**
* @param node: the node in the list should be deleted
* @return:...
分类:
其他好文 时间:
2016-06-29 11:28:28
阅读次数:
160
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example,Given n = 3, You should return the followi ...
分类:
编程语言 时间:
2016-06-27 15:31:55
阅读次数:
129
1. Set does not have ceiling method. Directly use TreeSet 2. ceiling > value - k, so value - ceiling < k. 3. Put 0 into set first since 0 should be th ...
分类:
其他好文 时间:
2016-06-27 12:08:32
阅读次数:
126
Given a binary tree, flatten it to a linked list in-place. For example,Given The flattened tree should look like: 思路: 将一个二叉树 就地 压成"链表"的结构; ...
分类:
其他好文 时间:
2016-06-26 23:45:26
阅读次数:
127
Given a binary tree Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL ...
分类:
编程语言 时间:
2016-06-25 19:02:56
阅读次数:
151
God, give me grace with serenity to accept the things that cannot be changed, Courage to change the things which should be changed, and the Wisdom to ...
分类:
其他好文 时间:
2016-06-25 12:07:31
阅读次数:
199
LRU Cache
Total Accepted: 76226 Total
Submissions: 481333 Difficulty: Hard
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the fo...
分类:
系统相关 时间:
2016-06-24 15:19:00
阅读次数:
201
Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be ...
分类:
编程语言 时间:
2016-06-24 14:25:51
阅读次数:
173