"""
Definition of ListNode
class ListNode(object):
def __init__(self, val, next=None):
self.val = val
self.next = next
"""
class Solution:
"""
@param head: n
@return: The new head of reversed linked list.
"""
def reverse(self, head):
# write your code here
pre_Node = None
while head:
next_Node = head.next
head.next = pre_Node
pre_Node = head
head = next_Node
return pre_Node