num1
and num2
to simplify the multiplication process.ans
of length num1.length + num2.length
with all zeros.num2
using index i
.num1
using index j
, multiply the digits at num1[j]
and num2[i]
.ans[i + j]
, and update ans[i + j]
with the ones place of this sum.ans[i + j + 1]
.