这个思路其实也很简单,就是把多位数字的各位拆分成加法的形式,其中每一项可以表示为 原数字 x 10的n次方。那么这个乘法就变成了两个多项式相乘,也就是3楼第二步所替换的方法体的含义了
算法题--实现乘法器0. 链接 题目链接 1. 题目 Given two non-negative integers num1 and num2 represented as strings, ...
这个思路其实也很简单,就是把多位数字的各位拆分成加法的形式,其中每一项可以表示为 原数字 x 10的n次方。那么这个乘法就变成了两个多项式相乘,也就是3楼第二步所替换的方法体的含义了
算法题--实现乘法器0. 链接 题目链接 1. 题目 Given two non-negative integers num1 and num2 represented as strings, ...
      方法二好像违背了题目的第四点要求的后半句
但此题的限制好像也不是很严,所以对于方法一我有个想法:不必用一个数组去记录各个数位上的乘积,直接用一个变量记录所有经转换的乘积之和,最后把这个变量转回字符
    
算法题--实现乘法器0. 链接 题目链接 1. 题目 Given two non-negative integers num1 and num2 represented as strings, ...
@岁月如歌2020 [握手][握手]😁
算法题--求蓄水池的蓄水量0. 链接 题目链接 1. 题目 Given n non-negative integers representing an elevation map where the ...
@岁月如歌2020 这个叫“夹逼法”😏
算法题--求蓄水池的蓄水量0. 链接 题目链接 1. 题目 Given n non-negative integers representing an elevation map where the ...
@岁月如歌2020 此法也是从别人那里学来的,只不过我喜欢去揣摩人家是怎么想到的,或者换个更形象的说法给算法做个解释
算法题--求蓄水池的蓄水量0. 链接 题目链接 1. 题目 Given n non-negative integers representing an elevation map where the ...
原题链接 思路说明: 把每一个非零列看成不同高度的长条积木:先把积木全拿走(后面的操作会按原来的高矮顺序排列),然后把最左侧与最右侧的积木先放回去,这样就能开始积水了。由于积...
      class Solution:
    def trap(self, height: List[int]) -> int:
        length = len(height)
        if length < 1:
            return 0
        
        leftMax = 0
        rightMax = 0
        leftP = 0
        rightP = len(height) - 1
        leftValue = height[leftP]
        rightValue = height[rightP]
        count = 0
        while leftP < rightP:
            if leftValue < rightValue:
                if leftValue < leftMax:
                    count += leftMax - leftValue
                else:
                    leftMax = leftValue
                leftP += 1
                leftValue = height[leftP]
            else:
                if rightValue < rightMax:
                    count += rightMax - rightValue
                else:
                    rightMax = rightValue
                rightP -= 1
                rightValue = height[rightP]
        return count
    
算法题--求蓄水池的蓄水量0. 链接 题目链接 1. 题目 Given n non-negative integers representing an elevation map where the ...
0. 链接 题目链接 1. 题目 Given an unsorted integer array, find the smallest missing positive in...