楼主:
Rushia (みけねこ的鼻屎)
2024-03-15 10:08:58https://leetcode.com/problems/product-of-array-except-self/
238. Product of Array Except Self
给你一个阵列nums,求出一个列表ls,ls[i] = 除了nums[i]以外的所有元素内积。
思路:
1.ls[i] = (0~i-1的积) * (i+1~n-1的积),遍历一次用一个阵列纪录左边的积,在遍历
一次从右到左,过程纪录右边的积,并把右边的积乘上左边的就好