C++ || Easy
\nclass Solution {\npublic:\n    int firstCompleteIndex(vector<int>& arr, vector<vector<int>>& mat) {\n        int r = mat.size(),c= mat[0].size();\n        vec
```\nclass Solution {\npublic:\n    int firstCompleteIndex(vector<int>& arr, vector<vector<int>>& mat) {\n        int r = mat.size(),c= mat[0].size();\n        vector<pair<int,int> > ind(r*c+1);\n        \n        for(int i=0;i<r;i++){\n            for(int j=0;j<c;j++){\n                ind[mat[i][j]] = {i,j};\n            }\n        }\n        \n        vector<int> szRow(r),szCol(c);\n        for(int i=0;i<r*c;i++){\n            int num = arr[i];\n            int x= ind[num].first,y=ind[num].second;\n            \n            szRow[x]++;\n            szCol[y]++;\n            if(szRow[x] == c || szCol[y] == r)\n                return i;\n        }\n        return -1;\n    }\n};\n```
['C']