3
int minDominoRotations(vector<int> &tops, vector<int> &bottoms) {4
vector<int> freq(7, 0);8
// there has to be particular tile number which is present in9
// every column to be able to arrange same tile in top or bottom10
// by rotating check which tile is present in every column11
for (int i = 0; i < n; ++i) {13
int bottom = bottoms[i];19
// check for potential tile number23
if (freq[bottom] == n) {28
if (tile == -1) { // rearrangement not possible34
for (int i = 0; i < n; ++i) {35
if (tops[i] == bottoms[i]) continue;37
if (tops[i] == tile) {40
if (bottoms[i] == tile) {45
return tilesTop < tilesBottom ? tilesTop : tilesBottom;