FastPrepConcatenate Digit-wise Sums
Problems/Concatenate Digit-wise Sums

Concatenate Digit-wise Sums

ZipRecruiter logoZipRecruiter● EasyNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A ZipRecruiter new-grad OA report describes inputs as decimal digit strings, adding position by position without carrying, joining each position's sum, and the result 1818 for 99 plus 99. It leaves out what happens with unequal lengths, leading zeros, limits, a function signature, and image data, so our version supplies those details.

You are given two non-empty strings a and b consisting of decimal digits.

Right-align the strings. For each aligned position, add the corresponding digits. If one string has no digit at that position, use the digit from the other string as the sum for that position.

Return a string formed by concatenating these per-position sums from the leftmost aligned position to the rightmost. A sum such as 18 contributes both characters 1 and 8; there is no carry between positions.

Function

concatenateDigitSums(a: String, b: String) → String

Examples

Example 1

a = "99"b = "99"return = "1818"

The two aligned positions each contain 9 + 9 = 18. Concatenating the two sums gives "1818".

Example 2

a = "11"b = "9"return = "110"

The leftmost position contains only 1, and the rightmost position has 1 + 9 = 10. Concatenating 1 and 10 gives "110".

Constraints

  • 1 <= a.length, b.length <= 105
  • a and b contain only decimal digits and each represents a positive integer.
  • Digits are aligned from the right, and every position is summed independently without carrying.

More ZipRecruiter Online Assessment questions

  • Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
  • Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
  • Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
  • Minimum Changes to Draw a YOA · Seen Oct 2024
  • Apply Binary State OperationsOA · Seen Sep 2024
  • Simulate Orchard Rot SpreadOA · Seen Sep 2024
  • Compare Odd- and Even-Index SumsOA · Seen Sep 2024
  • Coordinate Removals with Column GravityOA · Seen Sep 2024
  • Lexicographically Smallest End ReversalOA · Seen Sep 2024
  • Recursively Expanded Shell Command CountsOA · Seen Sep 2024

Similar questions at other companies

  • Rearrange String by Alternating EndsHudson River Trading · OAHudson River Trading interview questions
  • Alternate String EndsCapital One · OACapital One interview questions
  • Reverse First K Characters in Every 2K BlockArcesium · OAArcesium interview questions
  • Format TextTikTok · OATikTok interview questions
  • Thresholded Run-Length EncodingBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
  • Add Signed Character ArraysByteDance · PHONE SCREENByteDance interview questions
  • Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Robot Stops Left or Right (Forward Deployed Engineer)Boston Consulting Group · OABoston Consulting Group interview questions
  • Blood Type Inheritance: Possible Parent GenotypesAbridge · OAAbridge interview questions
  • REST API: Highest International StudentsRippling · OARippling interview questions

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public String concatenateDigitSums(String a, String b) {
        // Write your code here.
    }

}
Checking account…