// Function to add two strings. // If num2 is shorter than num1 or vice versa, use 0 as the current digit. let digit1 = i < num1.length ? num1[i] : 0; let digit2 = i < num2.length ? num2[i] : 0; // ...
// Function to add two strings. // If num1 is shorter than num2 or vice versa, use 0 as the current digit. int digit1 = i < num1.size() ? num1[i] : 0; int digit2 = i < num2.size() ? num2[i] : 0; // ...