← Cisco questions

Display and Manipulate Linked List

Filed under Cisco

Free read 3 of 3

Confirm definition of middle node for even-length lists (usually second middle).

The question

Perform standard operations on a singly linked list including displaying all elements, finding the middle node, and reversing the linked list.

Constraints

  • 0 <= number of nodes <= 5000
  • -10^4 <= node.val <= 10^4

Examples

Input
head = [1, 2, 3, 4, 5]
Output
Reversed: [5, 4, 3, 2, 1], Middle: 3
Why
Standard linked list utilities demonstrated on an odd-length list.

Approach

  1. Confirm definition of middle node for even-length lists (usually second middle).

Tips

  • What they are testing: Test with empty list, single node list, even number of nodes (for middle node behavior), and odd number of nodes.
  • Common mistake: Losing reference to the rest of the list when reversing or handling pointer updates.

Related Cisco questions

Collected from public candidate posts and coding forums. Updated Nov 2026.