Explained - using map || Very simple and easy to understand solution
\n# Approach\nWe will have two map for tracking the row and col of a number, so that we can get the row,col in O(1) time.\nThen we have another two map ( mprc, 
\n# Approach\nWe will have two map for tracking the row and col of a number, so that we can get the row,col in O(1) time.\nThen we have another two map ( mprc, mpcc) which basically count the no. elements seen in that row and no. of elements seen in that column.\n\n1. Map the row, col of each of elements\n2. Travesrse the arr and keep updatinf row & col count \n3. Once the row count equal to max or col count equal to max return index\n\n\n# Code\n```\nclass Solution {\npublic:\n    int firstCompleteIndex(vector<int>& arr, vector<vector<int>>& mat) {\n        unordered_map<int, int> mpr, mpc, mprc, mpcc;\n        for(int i = 0; i < mat.size(); i++){\n            for(int j = 0; j< mat[0].size(); ++j){\n                mpr[mat[i][j]] = i;     mpc[mat[i][j]] = j;\n            }\n        }\n        for(int i = 0; i < arr.size(); i++){\n            int n = arr[i];\n            mprc[mpr[n]]++;    mpcc[mpc[n]]++;\n            if(mprc[mpr[n]] == mat[0].size() || mpcc[mpc[n]] == mat.size()) return i;\n        }\n        return -1;\n    }\n};\n```\n\nSolution - 2: \nI find the following solution interesting by @Tushar_aherwar\n, with reverse mapping of the above solution: https://leetcode.com/problems/first-completely-painted-row-or-column/solutions/3469270/c-solution-space-complexity-o-n/?orderBy=most_votes\n\n<b>Here is an article of my recent interview experience - A Journey to FAANG Company, I recomand you to go through this to know which all resources I have used & how I cracked interview at Amazon:\nhttps://leetcode.com/discuss/interview-experience/3171859/Journey-to-a-FAANG-Company-Amazon-or-SDE2-(L5)-or-Bangalore-or-Oct-2022-Accepted
['C++']