{"id":2293,"date":"2026-07-20T12:43:14","date_gmt":"2026-07-20T10:43:14","guid":{"rendered":"https:\/\/kindsonthegenius.com\/blog\/how-to-reverse-a-linked-list\/"},"modified":"2026-07-20T12:43:14","modified_gmt":"2026-07-20T10:43:14","slug":"how-to-reverse-a-linked-list","status":"publish","type":"post","link":"https:\/\/kindsonthegenius.com\/blog\/how-to-reverse-a-linked-list\/","title":{"rendered":"How to Reverse A Linked List"},"content":{"rendered":"<h4><strong>Question &#8211; Linked List in Java<\/strong><\/h4>\n<p>How would you reverse a linked list in Java. For example.<\/p>\n<p>Input: 1 -&gt; 2 -&gt; 3 -&gt; 4<\/p>\n<p>Output:\u00a0 4 -&gt; 4 -&gt; 2 -&gt; 1<\/p>\n<p>&nbsp;<\/p>\n<h4><strong>Solution<\/strong><\/h4>\n<p>1. Iterative Approach:\u00a0 In this approach, we loop through the nodes of the linked list. Then we systematically change the previous and next pointers on each node.<\/p>\n<p><strong>The Algorithm<\/strong><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Question &#8211; Linked List in Java How would you reverse a linked list in Java. For example. Input: 1 -&gt; 2 -&gt; 3 -&gt; 4 &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"pagelayer_contact_templates":[],"_pagelayer_content":"","footnotes":""},"categories":[414],"tags":[],"class_list":["post-2293","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/2293","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/comments?post=2293"}],"version-history":[{"count":0,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/2293\/revisions"}],"wp:attachment":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/media?parent=2293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/categories?post=2293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/tags?post=2293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}