From 3306a93b918f9c3fd6f73beece83f0abcafe0eb0 Mon Sep 17 00:00:00 2001 From: Shafaqun Nisa Date: Sun, 5 Oct 2025 11:10:46 +0530 Subject: [PATCH] 1007. Minimum Domino Rotations For Equal Row.cpp --- ...Minimum Domino Rotations For Equal Row.cpp | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 1007. Minimum Domino Rotations For Equal Row.cpp 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