题目: 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 ...
原题地址:https: oj.leetcode.com problems rotate list 题意: Given a list, rotate the list to the right bykplaces, wherekis non negative. For example:Given gt gt gt gt gt NULLandk ,return gt gt gt gt gt NULL. ...
2014-06-13 11:19 0 3260 推荐指数:
题目: 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 ...
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 ...
原题地址:https://oj.leetcode.com/problems/rotate-image/ 题意: You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees ...
题目: 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 ...
原题地址:http://oj.leetcode.com/problems/sort-list/ 题意:链表的排序。要求:时间复杂度O(nlogn),空间复杂度O(1)。 解题思路:由于题目对时间复杂度和空间复杂度要求比较高,所以查看了各种解法,最好的解法就是归并排序,由于链表在归并操作时 ...
in place交换 如果是k步,那么就是把后面k个放到前面了嘛。 我们先把整个数组reverse,然后把前面的reverse回来,再把后面的reverse回来 对于AB我们要通过reve ...
原题地址:https://oj.leetcode.com/problems/partition-list/ 题意: Given a linked list and a value x, partition it such that all nodes less than x come ...
原题地址:http://oj.leetcode.com/problems/reorder-list/ 题意: Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You ...