Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 6420 |

@blackshadows | 6376 |

@mb1973 | 5604 |

@Quandray | 5231 |

@akhayrutdinov | 5111 |

@saiujwal13083 | 4510 |

@sanjay05 | 3762 |

@kirtidee18 | 3673 |

@marius_valentin_dragoi | 3522 |

@sushant_a | 3459 |

@verma_ji | 3413 |

Complete Leaderboard | |

Handle | Score |

@codersgroup18 | 799 |

@sriramgoparaju99 | 737 |

@Manikanta punnam | 629 |

@rdakka | 606 |

@prankursharma31 | 597 |

@praveenbgp6 | 546 |

@sanskar94511 | 531 |

@purohitmn02 | 525 |

@yashkaril4 | 517 |

@abhikarshgupta | 474 |

@rohitgarg2825 | 464 |

Complete Leaderboard |

Given two numbers represented by two different arrays **A** and **B**. The task is to find the sum array. The sum array is an array representation of addition of two input arrays.

**Example 1:**

**Input:
**N = 3, M = 3
A[] = {5, 6, 3}
B[] = {8, 4, 2}
**Output: **1 4 0 5
**Explanation:** As 563 + 842 = 1405.

**Example 2:**

**Input:
**N = 6, M = 4
A[] = {2, 2, 7, 5, 3, 3}
B[] = {4, 3, 3, 8}
**Output: **2 3 1 8 7 1
**Explanation:** As 227533 + 4338 = 231871.

**Your Task: **

You don't need to read input or print anything. Your task is to complete the function **findSum()** which takes the array(vector) of integers **a **and **b **as parameters and returns an array denoting the answer.

**Expected Time Complexity:** O(max(N, M))

**Expected Auxiliary Space:** O(1)

**Constraints:**

1 ≤ N ≤ M ≤ 10^{6}

0 ≤ A_{i}, B_{i }≤ 9

No leading zeroes in array A and B.

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes
Sum of two numbers represented as arrays

...