Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-nega...
分类:
其他好文 时间:
2014-07-07 14:58:47
阅读次数:
175
Given two numbers represented as strings, return multiplication of the numbers as a string.
分类:
其他好文 时间:
2014-06-27 12:38:25
阅读次数:
169
大数相乘,分别都是用字符串表示的两个大数,求相乘之后的结果表示。
首先我们应该考虑一下测试用例会有哪些,先准备测试用例对防御性编程会有比较大的帮助,能够考虑一些极端情况。有以下几种用例:
1)"0","0"
2)"0","879127346783" 其中一个是零
3)"as234","123343" 存在非法字符
4)"000000000000001234","2546" 存在零...
分类:
其他好文 时间:
2014-06-16 21:08:24
阅读次数:
255
题目
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.
方法
将num1与0-9相乘的结果存...
分类:
其他好文 时间:
2014-06-14 06:08:30
阅读次数:
229
原题地址:https://oj.leetcode.com/problems/multiply-strings/题意:Given
two numbers represented as strings, return multiplication of the numbers as a
string.N...
分类:
编程语言 时间:
2014-06-12 21:43:03
阅读次数:
344
Given two numbers represented as strings,
return multiplication of the numbers as a string.Note: The numbers can be
arbitrarily large and are non-nega...
分类:
其他好文 时间:
2014-06-04 20:19:04
阅读次数:
313
(function(){
var multiply = function(n1,n2){
var nstr1 = n1.toString();
var nstr2 = n2.toString();
var carry = 0;
var ret = "";
var di = 0;
var dj = 0;
var dig = 0.1;
for(var i = nstr1.length - 1 ;...
分类:
编程语言 时间:
2014-06-02 23:59:49
阅读次数:
509
题目:给定两个表示大数的字符串,求乘积,这里只针对正数。
分析:开始的时候打算一位一位的算,按着笔算的形式,但是写着写着发现太麻烦,后来在网上找到计算乘法的令一种技巧,感觉简洁多了。
先看代码,再分析。
string multiply(string num1, string num2) {
if(num1 == "0" || num2 == "0")
return "0";
//...
分类:
其他好文 时间:
2014-05-25 18:24:31
阅读次数:
195
【题目】
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.
【题意】
给定用字符串表示的整数,返回两个数的乘积结果字符串。两个数字都非负,且能任意大。
【思路】
1. 考虑其中一个数是0的情况
2. 模拟乘法运算...
分类:
其他好文 时间:
2014-05-21 13:45:37
阅读次数:
214
题目链接Given two numbers represented as strings,
return multiplication of the numbers as a string.Note: The numbers can be
arbitrarily large and are non-...
分类:
其他好文 时间:
2014-05-19 14:10:25
阅读次数:
250