标签:
给出A=[1, 2, 3],返回 B为[6, 3, 2]
public ArrayList<Long> productExcludeItself(ArrayList<Integer> A) { ArrayList<Long> rst = new ArrayList<>(); for(int i=0; i<A.size(); i++){ Long cur = 1L; for(int j=0; j<A.size(); j++){ if(j==i) continue; cur *= A.get(j); } rst.add(cur); } return rst; }
标签:
原文地址:http://www.cnblogs.com/hesier/p/5605483.html