# Question

Formatted question description: https://leetcode.ca/all/43.html

43. Multiply Strings

Given two non-negative integers num1 and num2 represented as strings,
return the product of num1 and num2, also represented as a string.

Example 1:

Input: num1 = "2", num2 = "3"
Output: "6"

Example 2:

Input: num1 = "123", num2 = "456"
Output: "56088"

Note:
The length of both num1 and num2 is < 110.
Both num1 and num2 contain only digits 0-9.
Both num1 and num2 do not contain any leading zero, except the number 0 itself.
You must not use any built-in BigInteger library or convert the inputs to integer directly.



# Algorithm

The length of the product obtained by multiplying two numbers does not actually exceed the sum of the lengths of the two numbers. If the length of num1 is m and the length of num2 is n, the length of num1 * num2 will not exceed m+n.

Understand why it is misplaced when multiplying. For example, the 48 obtained by multiplying 6 by 8 should be added with the wrong 54 obtained by multiplying 6 by 9, because 8 is a number in the tens place, which is equivalent to 80, so the staggered one is actually Need to add 0 at the end. One more thing to observe is that if two digits at any position in num1 and num2 are multiplied, the position of the two digits obtained in the final result is determined. For example, the number at position i in num1 is multiplied by the position in num2. If it is the number of j, then the positions of the two digits obtained are i+j and i+j+1. After you understand these, you can perform misplaced addition and accumulate the final result.

Since the multiplication starts from the ones digit, it traverses from the end of the num1 and num2 strings to extract the characters at the corresponding positions respectively, convert them to integers and multiply them.

Then determine the positions p1 and p2 where the two digits after the multiplication are located. Since p2 is lower than p1, the two digits mul obtained are added to the position of p2 first, which may cause the number of p2 to be greater than 9, so the number in the ten’s place must be added to the high-order p1, and only the remainder is left in the p2 position, so that the number in each place becomes one. The next thing to do is to start from the high bit and store the number in the result res, remember that leading zeros should be skipped, and finally deal with the next corner case, that is, if the result res is empty, return “0”, otherwise return the result

Java