Add 2 numbers represented by arrays

why do we insert 1 at 0th index if carry is still left,give an example

shubham plz share your code by saving on ide

https://ide.geeksforgeeks.org/2Dhldye7gW

Shubham, your doubt regarding why we insert 1 at 0th index if carry is still left can be understood by following example : if we add 2 nos ,
arr1 : 9 3 9
arr2 : 6 1
then sum calculated will be done from right to left, i.e
9+1 =10 , sum=10 , carry =1
3+6+1=10, sum=10, carry=1

now when we will traverse through 1st array, which contains only 9 and 1 will be added, i.e
9+1=10,
so we insert 1 at 0th index, because here carry is present, and it must be included so that your final ans will be 1000

I hope you understood this

thank you very much:grinning:

Plz mark your doubt resolved, if you were able to understand it

okay,please check my other doubts,its pending from 5 days