Tap here to switch tabs
Problem
Submissions

Problem: Count Ways to Choose Coprime Integers from Rows

Count Ways to Choose Coprime Integers from Rows asks you to choose one value from each matrix row and count selections whose greatest common divisor is one. Column choices matter.

Statement

You are given an m×nm \times n integer matrix mat.

Select exactly one integer from each row of mat. Return the total number of ways to choose these integers such that the greatest common divisor of all the selected integers is equal to 11.

Two choices are considered different if they select an element from a different column in at least one row.

Constraints:

  • 1≤1 \leq m ==== mat.length ≤150\leq 150

  • 1≤1 \leq n ==== mat[i].length ≤150\leq 150

  • 1≤1 \leq mat[i][j] ≤150\leq 150

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Ways to Choose Coprime Integers from Rows

Count Ways to Choose Coprime Integers from Rows asks you to choose one value from each matrix row and count selections whose greatest common divisor is one. Column choices matter.

Statement

You are given an m×nm \times n integer matrix mat.

Select exactly one integer from each row of mat. Return the total number of ways to choose these integers such that the greatest common divisor of all the selected integers is equal to 11.

Two choices are considered different if they select an element from a different column in at least one row.

Constraints:

  • 1≤1 \leq m ==== mat.length ≤150\leq 150

  • 1≤1 \leq n ==== mat[i].length ≤150\leq 150

  • 1≤1 \leq mat[i][j] ≤150\leq 150