The node stored in greater at the end of the code may not be the actual last one in the list we're given. We make it the last one by that line of code.
No one has replied
You change the objects of which the reference is passed in the function. So if I modify the object to which the passed reference is pointing I can change the actual contents.
It's supposed to reference a ListNode, so yes, do n1.next = n2. That &n2 or something like it doesn't even exist in Python.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.