Skip to main content
All Questions

Reverse a linked list.

Easy

Given the head of a singly linked list, reverse the list and return its head.

Implement a function reverseList that takes the head of the linked list as input and returns the new head of the reversed list.

Refer to the ListNode class/struct and do not comment it out.

Example

Input: 1 -> 2 -> 3 -> 4 Output: 4 -> 3 -> 2 -> 1

Interview experiences

5 shared
Bloomberg · 10 months ago
"I interviewed for an entry-level Software Engineer role after applying through my university, and the whole process was fully virtual. I did not have any OA or HackerRank up front. My loop was two technical coding rounds, then a recruiter conversation, then a hiring manager final, although I heard some people get parts of that bundled into more of a superday depending on availability. The coding rounds were standard LeetCode-style questions and felt collaborative, but the hiring manager round surprised me because it was more technical than I expected and included system design and language tradeoff questions. The process moved pretty fast overall, and I made it through the final round but did not get the offer."
Software Engineer · Entry Level / L3
Amazon · a year ago
"I interviewed for an Amazon Software Development Engineer internship in February 2025. The process was three rounds over about three weeks: a recruiter screen, a HackerRank assessment, and a final technical conversation that also included behavioral questions. The recruiter screen was straightforward and helpful for setting expectations. The HackerRank portion was the most time-sensitive part, so it rewarded being comfortable turning an approach into working code without spending too long on setup. The final interviewer was genuinely nice and the conversation felt collaborative. The coding problem was to reverse a linked list. I started by explaining the iterative solution and the pointer changes before coding, then walked through edge cases such as an empty list and a single-node list. The behavioral questions were folded into the same conversation, so I tried to make my answers concise and connect them to how I approach problem-solving and teamwork. Overall, it felt like a fair intern process: not designed to be tricky, but it did require clear communication and clean implementation under time pressure."
Software Engineer · Intern
IBM · 2 years ago
"The interview process was well-structured and transparent, spanning an online test, two technical rounds, and an HR discussion. The interviewers were approachable and gave me time to think through problems rather than rushing me. I appreciated the logical progression from aptitude to coding to design concepts. What went well was the technical discussion — I was able to clearly explain my project work and core CS concepts. What could have gone better was my initial nervousness during the first technical round, which slowed me down on a question I actually knew well. Overall, it was a positive and fair experience."
Software Engineer · Entry Level / L3
Infosys · 2 years ago
"The process was smoooth and easy.Phone round followed by a technical interview.I got the offer but i didnt accept it"
Software Engineer · Entry Level / L3
Amazon · 2 years ago
"It was really good as they do seem to care about interview and i had a great time discussing with the interviewer."
Software Engineer · Entry Level / L3

Related courses

Course

Machine Learning Engineer Interview Prep

Land your dream machine learning role at Meta, Google, Amazon, Apple, Microsoft, Nvidia, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates. Explore ML system design, core concepts, coding, behavioral interviews, and more.

Course

Data Science Interview Prep

Land your dream data science role at Google, Amazon, Microsoft, Meta, Apple, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates. Practice statistics, experimentation, coding, SQL, machine learning, behavioral interviews, and more.