Add to Array-Form of Integer Problem

Add to Array-Form of Integer Problem — ExecCode Easy DSA Practice

Solve the Add to Array-Form of Integer problem on ExecCode. Free online easy DSA practice in Arrays - Logic Building. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given num, the array-form of an integer, and an integer k, return the array-form of the integer num + k. Your task is to the array-form of an integer num is an array representing its digits in left to right order. For example, for num = 1321, the array form is [1,3,2,1]. Return the required answer exactly as shown in the examples.

Examples

Input {"num": [1, 2, 0, 0], "k": 34}; Output [1, 2, 3, 4]. Input {"num": [2, 7, 4], "k": 181}; Output [4, 5, 5]

Constraints

1 <= num.length <= 10^4 0 <= num[i] <= 9 num does not contain any leading zeros except for the zero itself. 1 <= k <= 10^4

Practice Add to Array-Form of Integer free on ExecCode. Browse DSA problems, topic map, and placement guides.