Practice First Completely Painted Row or Column
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given a 0-indexed integer array arr, and an m x n integer matrix mat. arr and mat both contain all the integers in the range [1, m * n]. Go through each index i in arr starting from index 0 and paint the cell in mat containing the integer arr[i]. Return the smallest index i at which either a row or a column will be completely painted in mat.
Source: First Completely Painted Row or Column on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
arr = [1,3,4,2], mat = [[1,4],[2,3]]
2
# Example 2
arr = [2,8,7,4,1,3,5,6,9], mat = [[3,2,5],[1,4,6],[8,7,9]]
3
Constraints
Related LeetCode Problems
Practice more problems similar to First Completely Painted Row or Column.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.