Skip to content

Commit 1313c74

Browse files
committed
May 03
1 parent 0abf8aa commit 1313c74

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
class Solution:
2+
def minDominoRotations(self, tops: list[int], bottoms: list[int]) -> int:
3+
for n in (tops[0], bottoms[0]):
4+
if all(n in pairs for pairs in zip(tops, bottoms)):
5+
return len(tops) - max(tops.count(n), bottoms.count(n))
6+
return -1
7+
8+
9+
def main():
10+
tops = [2, 1, 2, 4, 2, 2]
11+
bottoms = [5, 2, 6, 2, 3, 2]
12+
assert Solution().minDominoRotations(tops, bottoms) == 2
13+
14+
tops = [3, 5, 1, 2, 3]
15+
bottoms = [3, 6, 3, 3, 4]
16+
assert Solution().minDominoRotations(tops, bottoms) == -1
17+
18+
19+
if __name__ == '__main__':
20+
main()

2025-05-May-LeetCoding-Challenge/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
| --- | --- | --- | --- |
77
| May 01 | [2071. Maximum Number of Tasks You Can Assign](https://leetcode.com/problems/maximum-number-of-tasks-you-can-assign/) | Hard | Solved |
88
| May 02 | [838. Push Dominoes](https://leetcode.com/problems/push-dominoes/) | Medium | Solved |
9-
| May 03 | []() | | |
9+
| May 03 | [1007. Minimum Domino Rotations For Equal Row](https://leetcode.com/problems/minimum-domino-rotations-for-equal-row/) | Medium | Solved |
1010
| May 04 | []() | | |
1111
| May 05 | []() | | |
1212
| May 06 | []() | | |
@@ -41,5 +41,5 @@
4141
| Level | Problems | Solved | Unsolved |
4242
| --- | --- | --- | --- |
4343
| Easy | 0 | 0 | 0 |
44-
| Medium | 1 | 1 | 0 |
44+
| Medium | 2 | 2 | 0 |
4545
| Hard | 1 | 1 | 0 |

0 commit comments

Comments
 (0)