Add Two Large Usage Counters Stored as Linked Digit Lists

Last updated: November 29, 2026

Quick Overview

Two very large telemetry counters are stored as singly linked lists of decimal digits, most significant digit first. Return their sum as a new list in the same format without reversing the input lists.

Microsoft
Coding & Algorithms
Software Engineer
Microsoft
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Two very large telemetry counters are stored as singly linked lists of decimal digits, most significant digit first. Return their sum as a new list in the same format without reversing the input lists.

A Microsoft technical screen variant of adding linked list numbers, with the twist that digits are most significant first and inputs must stay unmodified. The interviewer looks for using stacks to process digits from the least significant end and building the result by prepending.

What the Interviewer Expects
  • Explain why most significant first order prevents a simple forward pass
  • Use two stacks (or recursion with length alignment)
  • Build the result by prepending so no final reversal is needed
  • Handle a final carry
  • Leave the input lists untouched
Key Topics to Cover
linked lists
stacks
carry propagation
big integer arithmetic
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • Do it in O(1) extra space other than the output.
  • How would you subtract the counters?
  • What if the lists are being appended to concurrently?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements
  • Inputs: two non-empty lists of digits 0 to 9, most significant first, no leading zeros except the number zero.
  • Output: a new list for the sum in the same order.
  • Inputs must not be modified....
High-Level Design

Addition proceeds from the least significant digit, which is at the end of each list. Push both lists' digits onto stacks so we can pop them in reverse order. Then repeatedly pop one digit from each s...


Submit Your Answer
Markdown supported