Real-Time Context
Powered by Bright Data to fetch real-world technical interview questions directly from active forums.
AI Synthesis
Gemini automatically transforms unstructured discussion threads into pristine, runnable LeetCode-style problems.
Zero Memorization
Stop grinding obsolete problem lists. Solve exactly what companies are asking today.
Experience the IDE
edith-workspace
1. Reverse Linked List
EasyLinked List
Given the head of a singly linked list, reverse the list, and return the reversed list.
Input: head = [1,2,3,4,5]
Output: [5,4,3,2,1]
class Solution {
reverseList(head: ListNode | null): ListNode | null {
let prev = null;let curr = head;while (curr !== null) {
const nextTemp = curr.next; curr.next = prev; prev = curr; curr = nextTemp;}
return prev;}
}