problem0043

package
v0.0.0-...-db5e768 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2019 License: MIT Imports: 0 Imported by: 0

README

43. Multiply Strings

题目

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

Note:

  1. The length of both num1 and num2 is < 110.
  2. Both num1 and num2 contains only digits 0-9.
  3. Both num1 and num2 does not contain any leading zero.
  4. You must not use any built-in BigInteger library or convert the inputs to integer directly.

解题思路

  1. 利用[]int{}记录中间计算过程,此时不考虑进位,例如,"123" 和 "65" 的记录为 []int{6,17,28,15}
  2. 统一处理进位,记录变为[]int{7,9,9,5}
  3. 转换为string,返回

细节见程序注释。

总结

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL