Leetcode 43: Multiply Strings

The general steps to do long multiplication are fairly straightforward but the implementation was a bit fiddly. I think it would be easier to to reverse the strings and work on them in reverse, then the least significant index will be zero. It is a bit fiddly to do the other way, which is how I did it below:

And the c++ source code:
https://gist.github.com/adamkorg/1d83d0f6eb273b2545e745196c8924d1

Here is a slightly simpler solution, where I add the numbers in reverse:

This entry was posted in programming and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.