国产探花免费观看_亚洲丰满少妇自慰呻吟_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
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 长宁区| 南澳县| 邵阳市| 墨脱县| 茌平县| 阿克苏市| 环江| 三河市| 三台县| 景洪市| 全椒县| 平顺县| 南宁市| 昔阳县| 高唐县| 泊头市| 延寿县| 岳池县| 开原市| 毕节市| 长治县| 江华| 遵义市| 祁连县| 渭南市| 东源县| 鹿泉市| 元阳县| 无为县| 樟树市| 贵港市| 民和| 齐齐哈尔市| 京山县| 昆明市| 罗山县| 桃园县| 巴林左旗| 京山县| 眉山市| 横山县|