C++, with explanation, intuitive (No DS)
\t/\n\tQues says, we are given with \'n\' dices\n\twhich are manufactured different such that , ith dice has tops[i] as value on top\n\tand bottoms[i] as value 
\t/*\n\tQues says, we are given with \'n\' dices\n\twhich are manufactured different such that , ith dice has tops[i] as value on top\n\tand bottoms[i] as value on bottom\n\n\tWe need to rotate dice (which here means, need to swap tops[i] and bottoms[i])\n\tsuch that , either of tops or bottoms becomes equal.\n\n\tExample of 6 dices:\n\ttops =      [2,1,2,4,2,2] \n\tbottoms =   [5,2,6,2,3,2]\n\tindex   =    0,1,2,3,4,5\n\n\n\tif we make swap at index 1 and 3\n\ttops =      [2,2,2,2,2,2] \n\tbottoms =   [5,1,6,4,3,2]\n\n\tthis makes tops equal with 2 minimum rotations\n\n\tfor thinking about solution, consider 4 cases\n\t1. first number of tops to make equal in tops itself\n\t2. first number of tops to make equal in bottoms\n\t3. first number of bottoms to make equal in tops\n\t4. first number of bottoms to make equal in bottoms\n\n\tif not possible from the first numbers, simply we can say , not possible to make equal at all\n\n\n\t*/\n\n\tclass Solution {\n\tpublic:\n\n\n\t\tint calcRotation(vector<int>& tops, vector<int>& bottoms, int num)\n\t\t{\n\t\t\tint rot = 0;\n\t\t\tint sz = tops.size();\n\t\t\tint i;\n\t\t\tfor(i = 0 ; i < sz ; i++)\n\t\t\t{\n\t\t\t\tif(tops[i] == num)\n\t\t\t\t\tcontinue;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif(bottoms[i] == num)\n\t\t\t\t\t\trot++;\n\t\t\t\t\telse\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn (i==sz)?rot : INT_MAX;\n\t\t}\n\n\t\tint minDominoRotations(vector<int>& tops, vector<int>& bottoms) {\n\t\t\tint num1 = tops[0];\n\t\t\tint num2 = bottoms[0];\n\t\t\tint sz = tops.size();\n\t\t\tint ret = INT_MAX;\n\n\t\t\tret = min(ret,calcRotation(tops,bottoms,num1));\n\t\t\tret = min(ret,calcRotation(tops,bottoms,num2));\n\t\t\tret = min(ret,calcRotation(bottoms,tops,num1));\n\t\t\tret = min(ret,calcRotation(bottoms,tops,num2));\n\n\t\t\treturn ret == INT_MAX? -1 : ret;\n\t\t}\n\t};
['C']