用栈实现队列
leetcode :
Implement Queue using Stacks
Implement the following operations of a queue using stacks.
push(x) -- Push element x to the back of queue.pop() -- Removes the element ...
分类:
其他好文 时间:
2015-08-02 16:53:21
阅读次数:
141
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-08-02 15:02:17
阅读次数:
82
Reverse a singly linked list.Hint:A linked list can be reversed either iteratively or recursively. Could you implement both?Solution 1:iteration 1 /**...
分类:
其他好文 时间:
2015-08-02 14:57:55
阅读次数:
117
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.
get(key) -
Get the value (will always be positive) of the key if ...
分类:
系统相关 时间:
2015-08-02 11:54:16
阅读次数:
159
Question
Implement int sqrt(int x).
Compute and return the square root of x.
My Solution
class Solution {
public:
int mySqrt(int x) {
/**
* binary search a from [0, x], where a^2 = x....
分类:
其他好文 时间:
2015-08-01 22:06:03
阅读次数:
87
Problem Definition:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrange...
分类:
其他好文 时间:
2015-08-01 21:57:44
阅读次数:
94
Implement pow(x,n).思路: 实现pow(x,n)函数。首先,可以n次连乘x,但是这样太慢了。加速:2^10 -> 4^5 -> 16^2 * 4 ->256^1 * 4C++: 1 class Solution { 2 public: 3 double myPow(dou...
分类:
其他好文 时间:
2015-08-01 15:32:20
阅读次数:
122
题目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() – Get the front element.
empty(...
分类:
其他好文 时间:
2015-08-01 10:08:20
阅读次数:
120
1、题目名称 String to Integer (atoi) (字符串到数字的转换) 2、题目地址 https://leetcode.com/problems/string-to-integer-atoi/ 3、题目内容 英文:Implement atoi to convert a string to an integer. 中文...
分类:
其他好文 时间:
2015-07-31 23:43:03
阅读次数:
432
之前的demo都是一个分组显示数据的
这次我们用的是带有分组的tableView
#import "WJJRootViewController.h"
@interface WJJRootViewController (){
UITableView * _tableView;
NSMutableArray * _dataArray;
}
@end
@implement...
分类:
其他好文 时间:
2015-07-31 20:29:20
阅读次数:
188