码迷,mamicode.com
首页 >  
搜索关键字:reverse polish notat    ( 5115个结果
小算法-计算下一个排列
2 8 5 3 11.从后往前,找到第一个逆序的数 pivot2.从后往前,找到第一个比pivot大的数 change3.交换 pivot 和 change的值4.把pivot这个位置后面的数 reverse,就是 8 5 2 1变成 1 2 5 8最终为3 1 2 5 8#include #inc...
分类:其他好文   时间:2014-06-13 17:38:19    阅读次数:378
Leetcode:Reverse Linked List II 反转链表区间
Reverse Linked List IIReverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given 1->2->3->4->5->NULL, m= 2 andn= 4,retu...
分类:其他好文   时间:2014-06-12 07:03:54    阅读次数:308
Reverse Linked List II
题目 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,...
分类:其他好文   时间:2014-06-11 06:07:11    阅读次数:392
LeetCode——
Add Two Numbers 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...
分类:其他好文   时间:2014-06-11 00:35:15    阅读次数:243
【leetcode】reverse Nodes in k-groups
问题: 给定一个链表的头指针,以及一个整数k,要求将链表按每k个为一组,组内进行链表逆置。少于k个的部分不做处理。 分析: 个人觉得问题的重点是熟悉链表的就地逆置操作,就是头插法。其他的考察点如果还有的话,就的细心程度。 实现: void reverseList(ListNode *&pre, ListNode *head) { ListNode *tail = NULL; w...
分类:其他好文   时间:2014-06-10 17:25:45    阅读次数:305
LeetCode——Reverse Words in a String
Given an input string, reverse the string word by word. For example, Given s = "the sky is blue", return "blue is sky the". Clarification: What constitutes a word? A sequence of non-space ch...
分类:其他好文   时间:2014-06-10 11:12:06    阅读次数:185
LeetCode OJ - Reverse Linked List II
题目:Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL...
分类:其他好文   时间:2014-06-09 23:03:18    阅读次数:254
leetcode——Reverse Words in a String 旋转字符串中单词顺序(AC)
题目如下: Given an input string, reverse the string word by word. For example, Given s = "the sky is blue", return "blue is sky the". click to show clarification. Clarification: What co...
分类:其他好文   时间:2014-06-08 14:58:13    阅读次数:231
[LeetCode] Reverse Integer [8]
题目 Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321。 解题思路: 颠倒一个整数中数字的位置,哈哈,类似翻转字符串一样,只不过整数需要计算,需要考虑溢出,其他无而。写出代码不难,只是溢出的时候怎么办,我这里是按照返回-1处理的,在leetcode上可以AC。 代码实现:...
分类:其他好文   时间:2014-06-08 14:47:58    阅读次数:257
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!