FastPrepAdd Signed Character Arrays
Problems/Add Signed Character Arrays

Add Signed Character Arrays

ByteDance logoByteDance● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The interview report asks for adding signed integers that are stored as character arrays. It does not say how to clean up the form, what to do with zero, or how large the numbers can be. Our version is about 90% the same as the reported question.

Two signed decimal integers are stored in character arrays left and right. Each array contains an optional leading + or -, followed by one or more decimal digits.

Return their exact sum as a normalized character array:

  • Do not use a fixed-width numeric conversion or arbitrary-precision integer library.
  • Remove leading zeros from the magnitude.
  • Use a leading - only when the result is negative.
  • Represent zero exactly as ['0'].

Function

addSignedNumbers(left: char[], right: char[]) → char[]

Examples

Example 1

left = ["-","1","2","3"]right = ["4","5"]return = ["-","7","8"]

The operands are -123 and 45, whose sum is -78.

Example 2

left = ["9","9","9"]right = ["1"]return = ["1","0","0","0"]

A carry propagates through all three digits, producing 1000.

Example 3

left = ["-","5","0"]right = ["+","5","0"]return = ["0"]

Equal magnitudes with opposite signs cancel, and zero has no sign.

Constraints

  • 1 <= left.length, right.length <= 200000
  • Each input has an optional leading sign followed by at least one decimal digit.
  • Each input is a valid integer encoding; leading zeros are allowed.
  • The total input size fits in memory.

More ByteDance Phone Screen questions

  • Count N-Queens PlacementsPHONE SCREEN · Seen Nov 2026
  • Matrix EscapePHONE SCREEN · Seen Nov 2026
  • Largest Number Below N from Reusable DigitsPHONE SCREEN · Seen Nov 2026
  • Log Analyzer: Busiest Service in a Rolling WindowPHONE SCREEN · Seen Nov 2026
  • Majority ElementPHONE SCREEN · Seen Nov 2026
  • Valid ParenthesesPHONE SCREEN · Seen Nov 2026
  • Binary Tree Target-Sum PathsPHONE SCREEN · Seen Nov 2026
  • Longest Increasing SubsequencePHONE SCREEN · Seen Nov 2026
  • Alien DictionaryPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Lexicographically Smallest Topological OrderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Add Two Numbers Given as Digit ArraysCapital One · ONSITE INTERVIEWCapital One interview questions
  • Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
  • Sliding Window Attention over a KV CacheNVIDIA · PHONE SCREENNVIDIA interview questions
  • Constant-Time Weighted Pick with an Alias TableEtched · PHONE SCREEN
  • Elevator Scheduling SimulationOpenAI · PHONE SCREENOpenAI interview questions
  • Candy Crush Grid Matching and GravityRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions
  • Compress Editor Actions into Operational Transform OperationsReplit · OA · PHONE SCREEN · ONSITE INTERVIEW
  • Find All Pythagorean TripletsDell Technologies · PHONE SCREENDell Technologies interview questions
  • Load/Store Arithmetic InterpreterJane Street · PHONE SCREENJane Street interview questions
  • Sort a Quadratic-Transformed ArrayLinkedIn · PHONE SCREENLinkedIn interview questions

ByteDance interview experiences

  • ByteDance TikTok USDS SWE Intern Interview: 1 Experience
  • ByteDance MLE New Grad Interviews: 1 Experience
  • ByteDance Security SRE Intern Phone Screens: 1 Experience
  • ByteDance USDS New Grad SWE Phone Screen: 1 Experience
  • ByteDance New Grad Data Engineer Video Interviews: 1 Experience
  • ByteDance Trust & Safety Research Scientist Intern: 1 Experience
All ByteDance interview questionsSee ByteDance hiring insights
Saved
class Solution {
    public char[] addSignedNumbers(char[] left, char[] right) {
      // write your code here
    }
}
Checking account…