leetcode61_旋轉鏈表

一. 迭代code 1. 先將鏈表閉合成環.blog 2.找到相應的位置斷開這個環.io class Solution { public: ListNode* rotateRight(ListNode* head, int k) { //邊界條件. if(head==NULL || head->next==NULL || k==0) return head;
相關文章
相關標籤/搜索