Python 3 solution - Easy to understand
IntuitionFirst, I created 3 dictionaries.
Dictionary with row numbers as key and count of elements in the row as values.
Dictionary with col numbers as key and
# Intuition
First, I created 3 dictionaries.
1. Dictionary with row numbers as key and count of elements in the row as values.
2. Dictionary with col numbers as key and count of elements in the column as values.
3. Dictionary with each number in the matrix as key and a list containing its row number and column number as values.
Dictionary 3 is created using dictionary comprehension which is the same as the code below:

```py
position = {}
for r in range(m):
    for c in range(n):
        position[mat[r][c]] = [r, c]
```

Next I iterated through the arr and for each number, I would get its row and column from dictionary 3 and reduce the count in dictionary's 1 and 2 by 1.

Finally I would check if any row or column count was 0 and if yes, then I would return the index of that number in the array.

# Code
```python []
class Solution:
    def firstCompleteIndex(self, arr: List[int], mat: List[List[int]]) -> int:
        m, n = len(mat), len(mat[0])
        rows = dict.fromkeys(range(m), n)
        cols = dict.fromkeys(range(n), m)
        position = {mat[r][c]: [r, c] for r in range(m) for c in range(n)}
        for i, n in enumerate(arr):
            r, c = position[n]
            rows[r] -= 1
            cols[c] -= 1
            if not rows[r] or not cols[c]:
                return i

```
['Python3']