其实crbegin就相当于cbegin+rbegin.
关于这两个函数可以看我的上两篇博文。
public member function
std::vector::crbegin
const_reverse_iterator crbegin() const noexcept;
Return const_reverse_iterator to ...
分类:
其他好文 时间:
2014-08-11 08:27:33
阅读次数:
262
//逆置单链表,原地操作,只需要遍历一遍
private?ListNode?reverse(ListNode?head)
{
????ListNode?pre?=?null;
????ListNode?cur?=?head;
????while(cur!=null)
????{
???????...
分类:
其他好文 时间:
2014-08-10 13:12:50
阅读次数:
284
题目:
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 digit. Add the two numbers and return it as a linked list.
Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
Outpu...
分类:
其他好文 时间:
2014-08-10 13:08:30
阅读次数:
296
说明:使用一个数字栈即可。(也可用数组链表模拟栈)
分类:
其他好文 时间:
2014-08-10 01:41:49
阅读次数:
191
public member function
std::vector::rbegin
C++98
C++11
reverse_iterator rbegin() noexcept;
const_reverse_iterator rbegin() const noexcept;
Return reverse iterator...
分类:
其他好文 时间:
2014-08-09 23:22:42
阅读次数:
684
题目
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask...
分类:
其他好文 时间:
2014-08-09 00:13:36
阅读次数:
309
Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another ex...
分类:
其他好文 时间:
2014-08-08 23:49:56
阅读次数:
314
思路:依次遍历输入string的每一个字符, 若当前字符是空格,则循环继续;否则,读取一个单词,并将其加入新string的头部;重复上述步骤。 1 void reverseWords( string &s ) { 2 string rStr = ""; 3 int size = s....
分类:
其他好文 时间:
2014-08-08 21:13:56
阅读次数:
207
Reverse a linked list from position m to n. Do it in-place and in one-pass.
For example:
Given 1->2->3->4->5->NULL, m =
2 and n = 4,
return 1->4->3->2->5->NULL.
Note:
Given m, n satisfy t...
分类:
其他好文 时间:
2014-08-07 19:02:50
阅读次数:
251
题目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 singl...
分类:
其他好文 时间:
2014-08-07 12:51:00
阅读次数:
188