Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Reverse a singly linked list

Hardware interview practice

Reverse a singly linked list

EasyLinked ListsSystemVerilog

Reverse a singly linked list in place and return its new head.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Reviewed example

Work through one case

Input
head = 1 -> 2 -> 3 -> null
Expected output
3 -> 2 -> 1 -> null

Each next pointer is reversed once, and the original tail becomes the new head.

What to cover

Requirements

  1. Do not allocate replacement nodes.
  2. Preserve the next node before changing the current link.
  3. Return null for an empty input list.
Continue practicing

Related questions

Linked ListsDetect a linked-list cycle→Linked ListsMerge two sorted linked lists→Linked ListsFind the middle node→
asic.fyi · Learn silicon end to end.info@asic.fyi