Tap here to switch tabs
Problem
Submissions

Problem: First Completely Painted Row or Column

med
30 min
Try to solve the First Completely Painted Row or Column problem.

Statement

You are given a 00 indexed integer array arr and an mimesnm imes n integer matrix mat. Both arr and mat contain every integer in the range [1,mimesn][1, m imes n].

Starting at index 00, iterate through arr and paint the cell in mat that contains the value arr[i].

Return the smallest index i at which at least one entire row or column in mat becomes fully painted.

Constraints:

  • m ==== mat.length

  • n ==== mat[i].length

  • arr.length ==== m $ imes$ n

  • 1≤1 \leq m, n ≤105\leq 10^5

  • 1≤1 \leq m $ imes$ n ≤105\leq 10^5

  • 1≤1 \leq arr[i], mat[r][c] ≤\leq m $ imes$ n

  • All the integers of arr are unique.

  • All the integers of mat are unique.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: First Completely Painted Row or Column

med
30 min
Try to solve the First Completely Painted Row or Column problem.

Statement

You are given a 00 indexed integer array arr and an mimesnm imes n integer matrix mat. Both arr and mat contain every integer in the range [1,mimesn][1, m imes n].

Starting at index 00, iterate through arr and paint the cell in mat that contains the value arr[i].

Return the smallest index i at which at least one entire row or column in mat becomes fully painted.

Constraints:

  • m ==== mat.length

  • n ==== mat[i].length

  • arr.length ==== m $ imes$ n

  • 1≤1 \leq m, n ≤105\leq 10^5

  • 1≤1 \leq m $ imes$ n ≤105\leq 10^5

  • 1≤1 \leq arr[i], mat[r][c] ≤\leq m $ imes$ n

  • All the integers of arr are unique.

  • All the integers of mat are unique.