Tap here to switch tabs
Problem
Submissions

Problem: Construct Product Matrix

Try to solve the Construct Product Matrix problem.

Statement

Given a 00 indexed 22D integer matrix grid of size n imes m, construct a product matrix p of the same dimensions where each element p[i][j] is equal to the product of all elements in grid except grid[i][j], modulo 1234512345.

Return the product matrix p.

Constraints:

  • 1≤1 \leq n ==== grid.length ≤105\leq 10^5

  • 1≤1 \leq m ==== grid[i].length ≤105\leq 10^5

  • 2≤2 \leq n * m ≤105\leq 10^5

  • 1≤1 \leq grid[i][j] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Construct Product Matrix

Try to solve the Construct Product Matrix problem.

Statement

Given a 00 indexed 22D integer matrix grid of size n imes m, construct a product matrix p of the same dimensions where each element p[i][j] is equal to the product of all elements in grid except grid[i][j], modulo 1234512345.

Return the product matrix p.

Constraints:

  • 1≤1 \leq n ==== grid.length ≤105\leq 10^5

  • 1≤1 \leq m ==== grid[i].length ≤105\leq 10^5

  • 2≤2 \leq n * m ≤105\leq 10^5

  • 1≤1 \leq grid[i][j] ≤109\leq 10^9