Given a binary matrix whose elements are only 0 and 1, we need to print the rows which are duplicate of rows which are already present in the matrix.
Input : [[1, 1, 0, 1, 0, 1], [0, 0, 1, 0, 0, 1], [1, 0, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1], [0, 0, 1, 0, 0, 1], [0, 0, 1, 0, 0, 1]] Output : (1, 1, 0, 1, 0, 1) (0, 0, 1, 0, 0, 1)
- Create a dictionary using counter method which will have rows as key and it’s frequency as value.
- Now traverse dictionary completely and print all rows which have frequency greater than 1.
(1, 1, 0, 1, 0, 1) (0, 0, 1, 0, 0, 1)
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Find duplicate rows in a binary matrix
- Python Counter| Find all duplicate characters in string
- Find pair of rows in a binary matrix that has maximum bit difference
- Python - Matrix elements Frequencies Counter
- Check if the rows of a binary matrix can be made unique by removing a single column
- Find all permuted rows of a given row in a matrix
- Find distinct elements common to all rows of a matrix
- Find a common element in all rows of a given row-wise sorted matrix
- Python - Concatenate string rows in Matrix
- Python | Print unique rows in a given boolean matrix using Set with tuples
- Python | Remove similar element rows in tuple Matrix
- Dictionary and counter in Python to find winner of election
- Python Counter to find the size of largest subset of anagram words
- Using Counter() in Python to find minimum character removal to make two strings anagram
- Python | Find keys with duplicate values in dictionary
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.