Add Numbers Stored in Four-Digit Chunks
Updated
Problem statement
Each array represents one nonnegative integer as base-10000 chunks in most-significant-first order. Every chunk is between 0 and 9999; conceptual leading zeroes inside a chunk are allowed.
Add the represented numbers and return normalized base-10000 chunks in the same order. Return [0] for zero and omit other leading zero chunks.
Function
addChunkedNumbers(first: int[], second: int[]) → int[]Examples
Example 1
first = [1,9999]second = [2]return = [2,1]9999 plus 2 produces a carry into the preceding chunk.
Example 2
first = [12,34]second = [5,6,7]return = [5,18,41]Missing high chunks are treated as zero.
Constraints
1 <= first.length, second.length <= 1000000 <= chunk < 10000
More ZipRecruiter Onsite Interview questions
- Restaurant Vote LeadersPHONE SCREEN · ONSITE INTERVIEW · Seen Feb 2026
- Sliding Window Rate LimiterOA · ONSITE INTERVIEW · Seen Oct 2022
- Sort an Integer Array in Ascending OrderOA · ONSITE INTERVIEW · Seen Apr 2022
- Classify an Alien Dictionary OrderingPHONE SCREEN · ONSITE INTERVIEW · Seen Mar 2022
- Add Two Numeric Strings with CarryONSITE INTERVIEW · Seen Nov 2021
- Expand Decimal Digits into Runs of OnesONSITE INTERVIEW · Seen Nov 2021
- Solve a Sudoku BoardONSITE INTERVIEW · Seen Aug 2021
- Validate a Sudoku BoardONSITE INTERVIEW · Seen Aug 2021
- Iterate Ragged Integer Lists VerticallyONSITE INTERVIEW · Seen May 2017
- Min StackONSITE INTERVIEW · Seen Feb 2017
Similar questions at other companies
- Add Two Numbers IIBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
- Subtract Forward-Order Linked-List NumbersMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Add Two Numbers Stored in Reversed ListsExpedia · ONSITE INTERVIEWExpedia interview questions
- Add Two Numbers Stored as Linked ListsCapital One · ONSITE INTERVIEWCapital One interview questions
- Add Forward Linked-List Numbers Using RecursionPeopleStrong · PHONE SCREENPeopleStrong interview questions
- Add NumbersCisco · OACisco interview questions
- Binary Linked List to DecimalJP Morgan Chase · OAJP Morgan Chase interview questions
- LRU Cache for Query ResultsAmazon · PHONE SCREEN · ONSITE INTERVIEW
- LRU CacheServiceNow · PHONE SCREEN · ONSITE INTERVIEWServiceNow interview questions
- Integers With Multiple Sum of Two CubesCharta Health · PHONE SCREEN · ONSITE INTERVIEWCharta Health interview questions