国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

LeetCode(43) Multiply Strings

2019-11-08 02:04:26
字體:
來源:轉載
供稿:網友

Description

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

Note:

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

Workflow

把字符串轉換為整形數據,然后相乘

Code

class Solution(object): def multiply(self, num1, num2): """ :type num1: str :type num2: str :rtype: str """ num1=self.str2int(num1) num2=self.str2int(num2) return str(num1*num2) def str2int(self,str): num=0 for i in range(len(str)): num+=int(str[i])*(10**(len(str)-i-1)) return num
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 灵寿县| 河池市| 盐源县| 乌拉特前旗| 松原市| 拉萨市| 阜新| 开江县| 乌兰县| 西盟| 明水县| 登封市| 隆昌县| 改则县| 银川市| 武平县| 手游| 凯里市| 南昌县| 岑巩县| 兴安盟| 织金县| 湟源县| 汝州市| 香格里拉县| 浮梁县| 利辛县| 惠州市| 南宫市| 北安市| 建瓯市| 黄冈市| 涟源市| 炎陵县| 天全县| 巴马| 兴业县| 沧州市| 黑河市| 巴林左旗| 通化市|