diff --git a/1007. Minimum Domino Rotations For Equal Row.cpp b/1007. Minimum Domino Rotations For Equal Row.cpp new file mode 100644 index 0000000..fde3488 --- /dev/null +++ b/1007. Minimum Domino Rotations For Equal Row.cpp @@ -0,0 +1,44 @@ +class Solution { +public: + int minDominoRotations(vector& tops, vector& bottoms) { + const int n = tops.size(); + + // Try to make all values equal to tops[0] or bottoms[0] + int X=tops[0], Y=bottoms[0]; + int swapXT=0, swapXB=0; + int swapYT=0, swapYB=0; + + bool hasX=1, hasY=1; + + for (int i=0; i