As reported: SAP Labs SAP@Scholar Software Engineer, on-campus drive (Bangalore, 2025), round 2 technical interview: reverse a linked list, implementing the linked list class as well.
This is LeetCode 206 — Reverse Linked List.
Reverse a singly linked list.
Example:
Input: 1->2->3->4->5->NULL
Output: 5->4->3->2->1->NULL
Code runner format: one JSON value per line, in argument order (head), as in LeetCode's test cases. Implement reverseList; the harness prints the result as compact JSON (sorted first when any order is accepted).