Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.
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.
給兩個字串num1和num2代表兩個非負整數,回傳num1和num2的乘積,回傳型態同樣使用字串。
注意:
- num1和num2的長度小於110。
- num1和num2都只會包含數字0-9。
- num1和num2都不會有0在開頭,除非他們本身就等於零。
- 你不應該使用任何內建大數函式庫,或是直接轉換輸入型別到數字。
string
相當於vector<char>
,你可能會因此溢位。LeetCode
C++