Runtime: 120 ms, faster than 88.94% of JavaScript online submissions for Add Two Numbers.
Memory Usage: 38 MB, less than 98.22% of JavaScript online submissions for Add Two Numbers.
Runtime: 128 ms, faster than 17.63% of JavaScript online submissions for Multiply Strings.
Memory Usage: 38.6 MB, less than 25.00% of JavaScript online submissions for Multiply Strings.
一直以来, 不是很喜欢 leetcode, 因为网站是求职向的, 而我因为兴趣才最重要.
工作也一直都是做业务, 没有怎么接触过算法. 我也就是游戏一下.
Add Two Numbers
https://leetcode.com/problems/add-two-numbers/submissions/
在我目前的实际工作中, 基本没有使用过链表. 还是比较生疏的.
基本思路就是简单递归.
在函数的制作过程中, 发现该函数还有更进一步的功能, 即进位制.
Runtime: 120 ms, faster than 88.94% of JavaScript online submissions for Add Two Numbers. Memory Usage: 38 MB, less than 98.22% of JavaScript online submissions for Add Two Numbers.
大数相乘
https://leetcode.com/problems/multiply-strings/
这个也是实际基本不会自己去写的. 对于 JavaScript 来说, 使用
BigInt
更简单高效.速度比较慢.
Runtime: 128 ms, faster than 17.63% of JavaScript online submissions for Multiply Strings. Memory Usage: 38.6 MB, less than 25.00% of JavaScript online submissions for Multiply Strings.