PracHub
QuestionsCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates proficiency in string-based arithmetic, digit-wise addition, carry propagation, and management of arbitrarily large non-negative integers without converting entire strings to native numeric types.

  • hard
  • Two Sigma
  • Coding & Algorithms
  • Data Scientist

Add two integer strings using digit-adder

Company: Two Sigma

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: hard

Interview Round: Technical Screen

## Coding Prompt You are given a helper function: - `addDigits(a, b) -> (sumDigit, carry)` - `a` and `b` are **single decimal digits** (characters `'0'`…`'9'` or integers 0…9). - It returns the **ones digit** of `a + b` and the **carry** (0 or 1). - Example: `addDigits(7, 8) -> (5, 1)`. ### Task Implement `addStrings(num1, num2) -> string` that returns the decimal string representing `num1 + num2`. ### Requirements - `num1` and `num2` are **non-negative integers** represented as strings (no leading `+`/`-`). - You may **not** convert the entire strings to built-in integer types (assume very long inputs). - You may only use the provided `addDigits` helper for digit-wise addition. ### Examples - `addStrings("11", "123") = "134"` - `addStrings("999", "1") = "1000"` - `addStrings("0", "0") = "0"` ### Constraints - Length of each string can be up to at least \(10^5\) characters. - Time should be linear in the total number of digits.

Quick Answer: This question evaluates proficiency in string-based arithmetic, digit-wise addition, carry propagation, and management of arbitrarily large non-negative integers without converting entire strings to native numeric types.

Return num1+num2 as a decimal string using digit-wise addition.

Constraints

  • Inputs are Python literals matching the function signature.
  • Return a deterministic exact-match value.

Examples

Input: ('11','123')

Expected Output: '134'

Explanation: Prompt example.

Input: ('999','1')

Expected Output: '1000'

Explanation: Carry chain.

Input: ('0','0')

Expected Output: '0'

Explanation: Zero.

Hints

  1. Model object-style prompts as arrays or operation streams when needed.
  2. Handle empty and boundary cases before the main logic.
Last updated: Jun 27, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Implement Price-Time Order Matching - Two Sigma (medium)
  • Compute Piecewise Linear Interpolation - Two Sigma (medium)
  • Implement an In-Memory Database - Two Sigma (hard)
  • Merge two sorted linked lists - Two Sigma (hard)
  • Merge Two Sorted Lists - Two Sigma (hard)