EASY TO UNDERSTAND || C++ || SIMPLE SOLUTION
\nclass Solution {\npublic:\n    int firstCompleteIndex(vector<int>& arr, vector<vector<int>>& mat) {\n        int a = mat.size(),b = mat[0].size(),c = arr.size
````\nclass Solution {\npublic:\n    int firstCompleteIndex(vector<int>& arr, vector<vector<int>>& mat) {\n        int a = mat.size(),b = mat[0].size(),c = arr.size();\n        vector<int> r1(a,0),c1(b,0);\n        vector<vector<int>> ind(a*b+1);\n        for(int i = 0; i < a; i++){\n            for(int j = 0; j < b; j++){\n                ind[mat[i][j]] = {i,j};\n            }\n        }\n        // for(int k = 0; k < c; k++){\n        //     cout<<arr[k]<<" "<<ind[arr[k]][0]<<" "<<ind[arr[k]][1]<<endl;\n        // }\n        for(int k = 0; k < c; k++){\n            r1[ind[arr[k]][0]]++;\n            c1[ind[arr[k]][1]]++;\n            // cout<<arr[k]<<" "<<ind[arr[k]][0]<<" "<<r1[ind[arr[k]][0]]<<" "<<ind[arr[k]][1]<<" "<<c1[ind[arr[k]][1]]<<endl;\n            if(r1[ind[arr[k]][0]]==b)return k;\n            if(c1[ind[arr[k]][1]]==a)return k;\n        }\n        return -1;\n    }\n};\n````
['Hash Table', 'C', 'Matrix', 'C++']