Algorithm · Microsoft · Easy
Given the head of a singly linked list, create a function that reverses the node order. Your implementation must run in O(n) time, with n representing the number of nodes. Example 1: The result places every node in the opposite order from the input list. Constraints: The number of nodes falls between 0 and 10000, inclusive. Every node stores an integer value. Example The reversed list begins with the original tail and ends with the original head.
Checking your access…