FastPrepFastPrep
Problem Brief

Add Numbers

INTERNOA
See Cisco online assessment and hiring insights

Write an algorithm to add the numbers and print them as a list.

Input

The first line of input consists of an integer- list1_size, representing the size of the first list (N). The second line consists of N space-separated integers representing the elements in the first list. The third line of input consists of an integer- list2_size, representing the size of the second list (M). The last line consists of M space-separated integers representing the elements in the second list.

Output

Print K space-separated integers representing the digits in reverse order which are the sum of both the numbers.

🫧𓇼𓏲*ੈ✩Credit to Charlotte‧₊˚🎐

1Example 1

Input
list1 = [2, 4, 6], list2 = [8, 0, 9]
Output
[0, 5, 5, 1]
Explanation

The given lists are [2,4,6], [8,0,9], so the two numbers are '642' and '908'. The sum of both the numbers is 642+908=1550. So the output is [0, 5, 5, 1].

Constraints

Limits and guarantees your solution can rely on.

🍐🍐
public List<Integer> addNumbers(List<Integer> list1, List<Integer> list2) {
  // write your code here
}
Input

list1

[2, 4, 6]

list2

[8, 0, 9]

Output

[0, 5, 5, 1]

Sign in to submit your solution.