Tap here to switch tabs
Problem
Submissions

Problem: Minimize Difference Between Target and Chosen Elements

Minimize Difference Between Target and Chosen Elements asks you to choose one value from each row of an integer matrix and return the minimum absolute difference between their sum and the target.

Statement

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

Choose 11 element from each row of mat such that the absolute difference between the sum of the chosen elements and target is minimized.

Return the minimum absolute difference.

Constraints:

  • m == mat.length

  • n == mat[i].length

  • 1≤1 \leq m, n ≤70\leq 70

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

  • 1≤1 \leq target ≤800\leq 800

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimize Difference Between Target and Chosen Elements

Minimize Difference Between Target and Chosen Elements asks you to choose one value from each row of an integer matrix and return the minimum absolute difference between their sum and the target.

Statement

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

Choose 11 element from each row of mat such that the absolute difference between the sum of the chosen elements and target is minimized.

Return the minimum absolute difference.

Constraints:

  • m == mat.length

  • n == mat[i].length

  • 1≤1 \leq m, n ≤70\leq 70

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

  • 1≤1 \leq target ≤800\leq 800