java easy solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int minDominoRotations(int[] tops, int[] bottoms) {\n        HashMap<Integer,Integer> hm=new HashMap<>();\n        for(int i=0;i<tops.length;i++){\n            if(tops[i]==bottoms[i]){\n                hm.put(tops[i],(hm.getOrDefault(tops[i],0)+1));\n            }\n            else{\n                hm.put(tops[i],(hm.getOrDefault(tops[i],0)+1));\n                hm.put(bottoms[i],(hm.getOrDefault(bottoms[i],0)+1));\n            }\n        }\n        int el=0;\n        boolean flag=false;\n        for(int i:hm.keySet()){\n            int a=hm.get(i);\n            if(a==tops.length){\n                el=i;\n                flag=true;\n                break;\n            }\n        }\n        if(!flag) return -1;\n        int ans1=0,ans2=0;\n        for(int i=0; i<tops.length; i++){\n            if(tops[i]!=el) ans1++;\n        }\n        for(int i=0; i<bottoms.length; i++){\n            if(bottoms[i]!=el) ans2++;\n        }\n        return Math.min(ans1,ans2);\n    }\n}\n```
['Hash Table', 'Java']