[leetcode]Reverse Integer...
分类:
其他好文 时间:
2014-09-17 21:55:22
阅读次数:
209
自变量的变换涉及到三个基本变换方式:伸缩(scale)、时移(shift)、反转(reverse)。变换通用的形式:x(t)->x(at+b)两种方法:可变对称抽和固定对称抽。1、可变对称抽:在三种基本变换中, 反转是相对于对称轴 t = 0 进行的, 而尺度变换中无论a为何值,t = 0的信号 x...
分类:
其他好文 时间:
2014-09-17 14:56:12
阅读次数:
289
题目不难,但是容易出错,需要考虑各种边界情况
非递归代码如下:
ListNode *reverseKGroup(ListNode *head, int k) {
if (head == NULL || k <= 1) return head;
ListNode * start = NULL, * end = NULL, *newHead = NULL, *p...
分类:
其他好文 时间:
2014-09-16 19:00:54
阅读次数:
201
基本思路是从后往前找到第一个递减的数num[index],并与之前的第一个大于num[index]的数交换位置。
注意交换后[index+1...n-1]仍是非递减的,所以只需要reverse一下,使其变成非递增的
void nextPermutation(vector &num) {
int index = num.size() - 2;
int rI...
分类:
其他好文 时间:
2014-09-16 17:23:40
阅读次数:
116
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 ...
分类:
其他好文 时间:
2014-09-15 12:41:48
阅读次数:
133
一直都对数组排序有点混淆不清,今天闲下来硬是找了些资料好好补课一下,感觉如下这篇还不错,于是转过来了。 reverse()、sort() 和 sortOn() reverse() 倒序排列sort() 按照多种预定义的方式对数组进行排序,甚至可用来创建自定义排序算法。sortOn() 方法可用来对对...
分类:
其他好文 时间:
2014-09-15 12:35:08
阅读次数:
155
原题地址:https://oj.leetcode.com/problems/reverse-linked-list-ii/题意:Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Gi...
分类:
编程语言 时间:
2014-09-14 23:38:47
阅读次数:
239
用C或C++实现void reverse( char* str )函数,即反转一个null结尾的字符串。分析:先确定字符串的长度,然后从两端往中间遍历,同时交换两端的元素。 1 #include 2 #include 3 #include 4 5 using namespace std; 6...
分类:
其他好文 时间:
2014-09-14 20:31:47
阅读次数:
209
Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321Have you thought about this?Here are some good questions to ask...
分类:
其他好文 时间:
2014-09-13 20:05:05
阅读次数:
189
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 ...
分类:
其他好文 时间:
2014-09-13 20:00:35
阅读次数:
207