I found that in your code, you have used arrays instead of linked lists
So that's why even if it is running correctly in vscode
It will not run in leetcode
I suggest you to consider building two Linked lists and write code for adding these two numbers
If you got the point Please support my YouTube channel, where I explain Leetcode questions : https://youtube.com/@rsaisiddhu?si=_K-zFkXAKAVYkMIw