实现了简单的vector有序插入,这个题目值得注意的点是1.当vector为空时,需要判断再排除 2.迭代器的使用是此段代码的特点int insertVector(vector & L, int k){ if(L.empty()){ L.push_back(k);...
分类:
其他好文 时间:
2014-12-28 23:34:09
阅读次数:
167
问题描述:
Write a program to solve a Sudoku puzzle by filling the empty cells.
Empty cells are indicated by the character
'.'.
You may assume that there will be only one unique solution.
A sud...
分类:
其他好文 时间:
2014-12-28 11:42:52
阅读次数:
360
队列的存储特性:FIFO(first in first out)即先进先出原则单向/双向队列*优先队列(与queue不同)存储方式: 带尾指针的单向链表 / 数组queue类:queue();bool empty() const;T &front(); //最先入的 队首元素const T ...
分类:
其他好文 时间:
2014-12-28 00:23:37
阅读次数:
191
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word...
分类:
移动开发 时间:
2014-12-27 23:03:14
阅读次数:
176
Scramble StringGiven a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible...
分类:
其他好文 时间:
2014-12-27 21:37:15
阅读次数:
192
Compare two version numbers version1 and version1.
If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.
You may assume that the version strings are non-empty and co...
分类:
其他好文 时间:
2014-12-27 09:01:59
阅读次数:
150
栈遵循LIFO ( last in first out) 即后入先出原则栈结构类似于叠盘子 后叠上去的要先拿走 才能拿到下面的盘子因此stack是一种访问受限的线性存储结构用单向链表的结构来存储stack类1 class stack2 {3 stack();4 bool empty(...
分类:
其他好文 时间:
2014-12-27 00:17:41
阅读次数:
288
Given an array of size n, find the majority element. The majority element is the element that appears more than ?
n/2 ? times.
You may assume that the array is non-empty and the majority element ...
分类:
其他好文 时间:
2014-12-26 23:03:33
阅读次数:
606
Sudoku SolverWrite a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character'.'.You may assume that the...
分类:
其他好文 时间:
2014-12-26 22:51:46
阅读次数:
266
问题描述:
Given an array of size n, find the majority element. The majority element is the element that appears more than
? n/2 ? times.
You may assume that the array is non-empty and the majority el...
分类:
其他好文 时间:
2014-12-26 20:19:14
阅读次数:
218