描述Reversealinkedlistfrompositionmton.Doitin-placeandinone-pass.Forexample:Given1->2->3->4->5->nullptr,m=2andn=4,return1->4->3->2->5->nullptr.Note:Givenm,nsatisfythefollowingcondition:1≤m≤n≤lengthoflist.这是第一次实现的代码..
分类:
其他好文 时间:
2016-05-25 07:08:13
阅读次数:
377
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 ...
分类:
其他好文 时间:
2016-05-24 22:43:30
阅读次数:
158
Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 click to show spoilers. Have you thought about this? Here a ...
分类:
其他好文 时间:
2016-05-24 22:21:01
阅读次数:
173
1.元素插入:insert()2.中序遍历:类似vector遍历(用迭代器)3.反向遍历:利用反向迭代器reverse_iterator。 例: set<int> s; ...... set<int>::reverse_iterator rit; for(rit=s.rbegin();rit!=s. ...
分类:
编程语言 时间:
2016-05-24 19:11:58
阅读次数:
380
代码: myctrl.js angular.module('app',[]) .controller('MyCtrl',function($scope){ $scope.msg=""; $scope.reverse=function(){ return $scope.msg.split("").re ...
分类:
其他好文 时间:
2016-05-24 18:42:46
阅读次数:
239
比较简单,细节:先将字符串翻转,注意进位。 string addBinary(string a, string b) { string result; int len = a.size() > b.size() ? a.size() : b.size(); reverse(a.begin(), a. ...
分类:
其他好文 时间:
2016-05-23 14:39:45
阅读次数:
121
HDU 5694 Problem Description 众所周知,度度熊喜欢的字符只有两个:B和D。今天,它发明了一种用B和D组成字符串的规则:S(1)=BS(2)=BBDS(3)=BBDBBDD…S(n)=S(n?1)+B+reverse(flip(S(n?1))其中,reverse(s)指将字 ...
分类:
其他好文 时间:
2016-05-21 19:08:05
阅读次数:
224
Problem: Write a function that takes a string as input and returns the string reversed. Example: Given s = "hello", return "olleh". One possible Solut ...
分类:
其他好文 时间:
2016-05-21 01:17:47
阅读次数:
140
Reverse Linked List Reverse a singly linked list. Hint: A linked list can be reversed either iteratively or recursively. Could you implement both? ...
分类:
其他好文 时间:
2016-05-20 13:26:09
阅读次数:
189
https://leetcode.com/problems/reverse-vowels-of-a-string/ 两个指针,查找交换字符。一开始忘记在SWAP之后,移动指针了,导致死循环。。。新学到一个string::npos indicates no matches。 1 #include <i ...
分类:
其他好文 时间:
2016-05-20 06:13:30
阅读次数:
298