LeetCode 206. Reverse Linked List Posted on 2021-08-18 In Leetcode , Linked List Symbols count in article: 410 Reading time ≈ 1 mins. QuestionGiven the head of a singly linked list, reverse the list, and return the reversed list. https://leetcode.com/problems/reverse-linked-list/ Solution1 12345678910111213class Solution { public ListNode reverseList(ListNode head) { ListNode prev = null; ListNode cur = head; while (cur != null){ ListNode next = cur.next; cur.next = prev; prev = cur; cur = next; } return prev; }} Complexity: Time complexity: O(n) Space complexity: O(1) Post author: MrainW Post link: https://mrainw.github.io/2021/08/18/LeetCode 206. Reverse Linked List/ Copyright Notice: All articles in this blog are licensed under BY-NC-SA unless stating additionally. Welcome to my other publishing channels WeChat