main.m 1 #import 2 /** 3 * 测试指针型参数和普通参数的区别 4 * 5 * @param a 指针型参数 6 * @param b 普通参数 7 * 8 * @return (指针型参数+2) + (普通参数+2) 9 */10 int pointe...
分类:
其他好文 时间:
2015-06-13 21:27:41
阅读次数:
117
main.cpp#include "Singleton.h"#include using namespace std;int main(int argc, char *argv[]) { Singleton *sgn = Singleton::Instance(); return...
分类:
其他好文 时间:
2015-06-13 18:27:35
阅读次数:
141
Given a collection of numbers, return all possible permutations.For example,[1,2,3]have the following permutations:[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,...
分类:
其他好文 时间:
2015-06-13 16:55:52
阅读次数:
146
见苹果开发里面添加成员变量特别有趣,我们C++能不能这样呢?下面的宏就可以帮你快速添加类成员
#define _member_( type, name ) private: type _##name;public: type get_##name(){ return _##name; }void set_##name(type name##_){ _##name = ##...
分类:
移动开发 时间:
2015-06-13 15:46:17
阅读次数:
126
Implement the following operations of a stack using queues.
push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get the top element.empty() -- Return whet...
分类:
其他好文 时间:
2015-06-13 15:42:34
阅读次数:
132
public class MySet {
private int capacity = 0; //容器的容量
private int size = 0; //容器内的对象个数
private Object[] objs = new Object[0]; //容器数组
public boolean add(Object obj) {
return add(obj...
分类:
其他好文 时间:
2015-06-13 15:41:52
阅读次数:
216
Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to right, then right to left for the next level and alternate between).For example:
Given binary tree...
分类:
其他好文 时间:
2015-06-13 14:20:17
阅读次数:
121
dispatch_sync: ?Submits a block to a dispatch queue like dispatch_async(), however ? dispatch_sync() will not return until the block has finished. ? ?Calls to dispatch_sync() targeting the curr...
分类:
其他好文 时间:
2015-06-13 13:02:02
阅读次数:
233
Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root).For example:
Given binary tree {3,9,20,#,#,15,7}, 3...
分类:
其他好文 时间:
2015-06-13 12:57:50
阅读次数:
98
Given a binary tree, return the preorder traversal of its nodes’ values.For example:
Given binary tree{1,#,2,3}, 1
2
/
3return [1,2,3].递归遍历:/**C++
* Definition for a binary tree n...
分类:
其他好文 时间:
2015-06-13 11:27:51
阅读次数:
143