Algorithm/52_ConstructArray at master · Julianbb/Algorithm · GitHub
Skip to content

Latest commit

 

History

History

Folders and files

题目:
给定一个数组A[0,1...n-1],请构造一个数组B[0,1...n-1],其中B的元素B[i]=A[0]xA[1]x...xA[i-1]xA[i+1]x...xA[n-1],不能使用除法。
提示:

  1. 将B的构造看成矩阵的构造
  2. B[i] = 它的左边* 它的右边
  3. 先计算每个元素的左边,在计算每个元素的右边,再乘