天天看點

[LeetCode]--43. Multiply Strings

given two numbers represented as strings, return multiplication of the numbers as a string.

note:

the numbers can be arbitrarily large and are non-negative.

converting the input string to integer is not allowed.

you should not use internal library such as biginteger.

字元串拆分成字元,然後計算,注意進位就行,進位中又要特别注意最高位進位。最開始我用int計算,其實還是逃不過超出範圍的限制,是以就用個int的數組,隻記錄每一位數字,然後用這個數組來構造字元串。

還有一個比我簡便一點點方法。