haoel/leetcode

[Rotate List] there is a better solution

Opened this issue · 3 comments

//Shit! the K also rotated!
p2 = head;

Given the length n, you only need to loop about n~2n times if k is much more bigger than n.

You are right! let me do some improvement.

code change : 356254b

(oops, seems github misses match the code commit message to close the issue.)

Great, more interesting than my two pointers version. 👍