題目: 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 ...