Adding two numbers using linked lists in Java

#100DaysOfCode – Day 89 Linked Lists & Big Number Addition 🔹 Problem: Add Two Numbers You’re given two non-empty linked lists representing numbers. Each node stores a single digit, and the digits are stored in reverse order. 🔹 My Approach: Used a dummy node to simplify list construction. Traversed both lists simultaneously while managing the carry. Created new nodes for each digit of the sum using modular arithmetic. Continued until both lists and carry were fully processed. Time Complexity: O(max(N, M)) Space Complexity: O(max(N, M)) Even in linked lists, clean logic + careful pointer handling can simplify complex problems. This challenge reinforced how breaking big tasks into smaller, consistent steps leads to efficient solutions. #takeUforward #100DaysOfCode #LinkedList #Java #ProblemSolving #LeetCode #DSA #CodingJourney #CodeNewbie #ChitkaraUniversity

  • graphical user interface, text

Kanhaiya Lal, love how you walked through the pointer logic here. That carry handling trick with modular arithmetic is exactly the kind of clean approach that makes linked list problems way less messy.

To view or add a comment, sign in

Explore content categories