leetcode238

Posted AsenYang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了leetcode238相关的知识,希望对你有一定的参考价值。

public class Solution {
    public int[] ProductExceptSelf(int[] nums) {
        int[] result = new int[nums.Length];
            for (int i = 0, tmp = 1; i < nums.Length; i++)
            {
                result[i] = tmp;
                tmp *= nums[i];
            }
            for (int i = nums.Length - 1, tmp = 1; i >= 0; i--)
            {
                result[i] *= tmp;
                tmp *= nums[i];
            }
            return result;
    }
}

https://leetcode.com/problems/product-of-array-except-self/#/description

以上是关于leetcode238的主要内容,如果未能解决你的问题,请参考以下文章

leetcode 238. Product of Array Except Self (Python版)

leetcode238

LeetCode OJ 238. Product of Array Except Self 解题报告

c_cpp leetcode_238.cpp

leetcode:238. Product of Array Except Self(Java)解答

Leetcode 238. Product of Array Except Self