【枚举类型】
使用emum关键字创建枚举。
// 定义一个枚举,用来表示方向enum Direction{ up, down, middle, left, right};枚举的值都可以用数字表示,默认从零开始递增 enum Direction direction = up ;// 输出0 NSLog...
分类:
编程语言 时间:
2015-01-25 17:55:53
阅读次数:
172
今天学习Bootstrap时候,看到按钮的向下三角形源码:
.caret {
display: inline-block;
width: 0;
height: 0;
margin-left: 2px;
vertical-align: middle;
border-top: 4px solid;
border-right: 4px solid transparent...
分类:
Web程序 时间:
2015-01-23 13:24:48
阅读次数:
117
Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2]have the following unique perm...
分类:
其他好文 时间:
2015-01-21 22:16:01
阅读次数:
290
Given a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thesamerepeated num...
分类:
其他好文 时间:
2015-01-21 14:53:00
阅读次数:
110
Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a solution is:[ [2,4], [3,4], [2,3],...
分类:
其他好文 时间:
2015-01-20 23:39:07
阅读次数:
255
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.思路:题目看上去好像很难,但实际上很简单,递归做就行,每次找到左右子树对应的子链表...
分类:
其他好文 时间:
2015-01-18 21:03:17
阅读次数:
241
Sort a linked list using insertion sort.思路:用插入排序对链表排序。插入排序是指每次在一个排好序的链表中插入一个新的值。注意:把排好序的部分和未排序的部分完全分开,指针不要有交叉。 即不会通过->next 重叠class Solution {public: ....
分类:
其他好文 时间:
2015-01-18 19:45:01
阅读次数:
162
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ...
分类:
其他好文 时间:
2015-01-17 22:12:46
阅读次数:
168
Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level and al...
分类:
其他好文 时间:
2015-01-17 17:58:07
阅读次数:
199
Frogger
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 27020
Accepted: 8797
Description
Freddy Frog is sitting on a stone in the middle of a lake. Sud...
分类:
编程语言 时间:
2015-01-16 16:49:44
阅读次数:
208