JAVA Easiest Solution #google 2020 imp ques. (Intuition+Solution)
If helpful , please do Upvote\n\nhttps://www.youtube.com/watch?v=9Q73ScVu2GI\n\n\nclass Solution {\n    public int minDominoRotations(int[] A, int[] B) {\n     
**If helpful , please do Upvote**\n\n[https://www.youtube.com/watch?v=9Q73ScVu2GI](http://)\n\n```\nclass Solution {\n    public int minDominoRotations(int[] A, int[] B) {\n        // Intuition behind solution: simulate the few possibilities that exist for making an entire row equal. \n\t\t//A[0] matching A, B[0] matching A, A[0] matching B, and B[0] matching B. \n\t\t//If any of these are possible, continuously update your return value to be the minimum swaps. \n\t\t//If it is not possible, return -1.\n         \n        \n        \n        int minSwaps=Math.min(numSwaps(A[0],A,B),numSwaps(B[0],A,B));\n    \n        minSwaps=Math.min(minSwaps,numSwaps(A[0],B,A));\n        minSwaps=Math.min(minSwaps,numSwaps(B[0],B,A));\n        \n        return minSwaps==Integer.MAX_VALUE?-1:minSwaps;\n    }\n    \n    public int numSwaps(int target,int[] A,int[] B){\n        int numSwaps=0;\n        for(int i=0;i<A.length;i++){\n            if(A[i]!=target && B[i]!=target){\n                return Integer.MAX_VALUE;\n            }\n            else if(A[i]!=target){\n                numSwaps++;\n            }\n        }\n        return numSwaps;\n    }\n}\n```
['Java']