43. Multiply Strings(string模拟大数乘法)
Given two numbers represented as strings,return multiplication of the numbers as a string. Note:
Subscribe?to see which companies asked this question 分析: ac代码: class Solution { public: //模拟手算从最后一位开始处理? //进位? //转换成字符串? //前导0 ? ? ? ? for(i=0;i<L;i++) ? ? ? ? { ? ? ? ? ? ? if(rets[i]!='0') ? ? ? ? ? ? ? ? break; ? ? ? ? } ? ? ? ? if(i==L) ? ? ? ? ? ? return "0"; ? ? ? ? return rets.substr(i,L-i); ? ? } }; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |