目标:rotate(s,m)将字符串s的前m位左旋至末尾。例:s = abcdefghijkrotate(s,3) = defghijkabc思路:1. 假设字符串s需要调整位置,设置指针p1指向s起点,p2指向起点+m的位置,这里p1->a, p2->d。2. 交换p1和p2指向的元素,同时让p1...
分类:
其他好文 时间:
2015-07-17 13:31:24
阅读次数:
115
题目:
Given a list, rotate the list to the right by k places, where k is non-negative.
For example:
Given 1->2->3->4->5->NULL and k = 2,
return 4->5->1->2->3->NULL.
题意:
给定一个链表,以距离右边界...
分类:
编程语言 时间:
2015-07-17 10:04:08
阅读次数:
153
Well, in the case of a linked list instead of an array, the problem becomes easier. We just need to find the node that will be the new head of the lis...
分类:
其他好文 时间:
2015-07-17 08:25:26
阅读次数:
121
由于倒排索引文件往往占用巨大的磁盘空间,我们自然想到对数据进行压缩。同时,引进压缩算法后,使得磁盘占用减少,操作系统在query processing过程中磁盘读取效率也能提升。另外,压缩算法不仅要考虑压缩效果,还要照顾到query processing过程的解压缩效率。总的来说,好的索引压缩算法需...
分类:
编程语言 时间:
2015-07-17 08:24:16
阅读次数:
298
This problem, as stated in the problem statement, has a lot of solutions. Since the problem requires us to solve it in O(1) space complexity, I only s...
分类:
其他好文 时间:
2015-07-17 08:23:43
阅读次数:
116
1.6 Given an image represented by an NxN matrix, where each pixel in the image is 4 bytes, write a method to rotate the image by 90 degrees. Can you d...
分类:
其他好文 时间:
2015-07-17 07:07:39
阅读次数:
126
题目:You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?解题思路:In-place So...
分类:
其他好文 时间:
2015-07-16 23:53:38
阅读次数:
116
_RESPONSE_STATUSES = { # Informational 100: 'Continue', 101: 'Switching Protocols', 102: 'Processing', # Successful 200: 'OK', 20...
分类:
编程语言 时间:
2015-07-16 13:45:20
阅读次数:
233
Problem:You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?思路:顺时针方...
分类:
其他好文 时间:
2015-07-16 11:23:49
阅读次数:
121
class Solution {public: void rotate(vector& nums, int k) { int n=nums.size(); int i=0; /*//-------------------//解法一 ...
分类:
编程语言 时间:
2015-07-16 11:06:14
阅读次数:
145