Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Latest commit

 

History

History
executable file
·
20 lines (14 loc) · 727 Bytes

File metadata and controls

executable file
·
20 lines (14 loc) · 727 Bytes

题目

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,返回

细节见程序注释。

总结