标签:problems ref array cep desc rod com rip public
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
标签:problems ref array cep desc rod com rip public
原文地址:http://www.cnblogs.com/asenyang/p/6832048.html