Simple | ✅
Code\n\nclass Solution {\n    public int firstCompleteIndex(int[] arr, int[][] mat) {\n        HashMap<Integer,int[]> map=new HashMap<>();\n        HashMap<Inte
# Code\n```\nclass Solution {\n    public int firstCompleteIndex(int[] arr, int[][] mat) {\n        HashMap<Integer,int[]> map=new HashMap<>();\n        HashMap<Integer,Integer> row=new HashMap<>();\n        HashMap<Integer,Integer> col=new HashMap<>();\n        for(int i=0; i<mat.length; i++){\n            for(int j=0; j<mat[0].length; j++){\n                map.put(mat[i][j], new int[]{i,j});\n            }\n        }\n        for(int i=0; i<arr.length; i++){\n            int[] temp=map.get(arr[i]);\n            int r=temp[0];\n            int c=temp[1];         \n            row.put(r, row.getOrDefault(r, 0) + 1);\n            col.put(c, col.getOrDefault(c, 0) + 1);\n            if(row.get(r)==mat[0].length || col.get(c)==mat.length){\n                return i;\n            }\n        }\n        return -1;\n    }\n}\n```\n______________________________________\n\n# **Up Vote if Helps**![image.png](https://assets.leetcode.com/users/images/23d8443e-ac59-49d5-99f0-9273a2147be2_1687635435.0337658.png)\n\n______________________________________
['Array', 'Hash Function', 'Java']