<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Veerasiva R on Medium]]></title>
        <description><![CDATA[Stories by Veerasiva R on Medium]]></description>
        <link>https://medium.com/@veerasiva?source=rss-1dfc3a368284------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*6yD5wobTx-nsWCXW</url>
            <title>Stories by Veerasiva R on Medium</title>
            <link>https://medium.com/@veerasiva?source=rss-1dfc3a368284------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 21:43:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@veerasiva/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[L.2 — Add two numbers]]></title>
            <link>https://veerasiva.medium.com/l-2-add-two-numbers-9da198cd5e58?source=rss-1dfc3a368284------2</link>
            <guid isPermaLink="false">https://medium.com/p/9da198cd5e58</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[linkedlist-in-java]]></category>
            <category><![CDATA[striver-sheet]]></category>
            <dc:creator><![CDATA[Veerasiva R]]></dc:creator>
            <pubDate>Fri, 19 Sep 2025 09:05:52 GMT</pubDate>
            <atom:updated>2025-09-19T09:05:52.434Z</atom:updated>
            <content:encoded><![CDATA[<h3>L.2 — Add two numbers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*D_Da2IZBDRPRcpBdHed72g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/0*b6be8wOffpBjWdOj.jpg" /></figure><p>The <a href="https://leetcode.com/problems/add-two-numbers/description/">question</a> is quite simple. We are given with two lists and our goal is to add each node at their respective position and store it in a new list and return the result list’s head.</p><p>We first create a dummy node to return the head without any consequence and current node for creating every new node and proceeding forward.</p><p>The loop should continue till there is at least one node from either list that is not null. we should also be careful with the carry since while adding there can be carry which must be carried forward to add it to the next sum.</p><p>So we every time calculate the sum with if the t1 is not null we add that data to the sum same for t2. and also if it is not null we should move them to next node. if null we don’t have to (that means the one list traversal is completed and we’re left with another list (if not both are null)).</p><p>Then we create a node with data will be sum%10 (why because 9+9 will be 18 and now we want only 8 first. 1 will be carried forward) and to adjust the carry we do carry = sum /10 which will remove the 8 and gives us 1 in this case (9+9).</p><p>Then we make our current node point to the temp node and we move the current node forward. After the traversal is completed we should check whether there’s still a carry if yes we should create a node and put that carry and make the current node connect to it sequentially.</p><p>Lastly we know dummyNode is there it’s next will be out head, so we return it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9da198cd5e58" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>