← 返回 microsoft 的题目列表Reverse a Linked List
类型:online_judge
microsoft
Given a singly linked list, write a function to reverse the list. You need to accomplish this in O(n) time, where n is the length of the list.
Example 1:
Input: 1->2->3->4->5->NULL
Output: 5->4->3->2->1->NULL
Constraints:
The list length is in the range [0, 10000].
Each node's value is an integer.
Example
Input
1->2->3->4->5->NULL