20191025-leetcode-61旋轉鏈表(鏈表操做)

思路: (1)先把鏈表改爲一個循環鏈表,方便後續操做。 (2)遍歷找到完成後鏈表的頭結點,而後遍歷記錄便可。web /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ cl
相關文章
相關標籤/搜索