quaisx / matrixx

Technical interview coding exercise: Write a method to reverse the order of a singly linked list

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Technical Interview

Coding exercise

Reverse the order of nodes in a singly linked list.

Given an original singly linked list A->B->C->D

graph TD;
    A-->B;
    B-->C;
    C-->D;
Loading

Reverse it to D->C->B->A;

graph TD;
  D-->C;
  C-->B;
  B-->A;
Loading

This coding exercise is very popular among employers. Personally, when actively looking for my next project, I get asked this question, at least, once a week. Keep a solution to this, or a similar coding exercise, in your tool belt.

About

Technical interview coding exercise: Write a method to reverse the order of a singly linked list


Languages

Language:Go 100.0%