Tap here to switch tabs
Problem
Submissions

Problem: Minimize Difference Between Target and Chosen Elements

Try to solve the Minimize the Difference Between Target and Chosen Elements problem.

Statement

You are given an m $ imes$ 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

Try to solve the Minimize the Difference Between Target and Chosen Elements problem.

Statement

You are given an m $ imes$ 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