• Tutorials
  • DSA
  • Data Science
  • Web Tech
  • Courses
July 30, 2024 |70 Views

SDE Sheet - Print unique rows in a given Binary matrix

Description
Discussion

This video is part of the Trie section under GFG SDE Sheet.

Given a binary matrix your task is to find all unique rows of the given matrix in the order of their appearance in the matrix.

Example 1:

Input: row = 3, col = 4 M[][] = {{1 1 0 1},{1 0 0 1},{1 1 0 1}}
Output: $1 1 0 1 $1 0 0 1 $
Explanation: Above the matrix of size 3x4 looks like 1 1 0 1 1 0 0 1 1 1 0 1 The two unique rows are R1: {1 1 0 1} and R2: {1 0 0 1}. 
As R1 first appeared at row-0 and R2 appeared at row-1, in the resulting list, R1 is kept before R2.

Try it out before watching the implementation of the problem in the video. We recommend watching the video, even if you can solve the problem. You may discover something new. All the best!!!

Do check out:-
Problem: https://www.geeksforgeeks.org/problems/unique-rows-in-boolean-matrix/1
SDE Sheet Link: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/
Article Link: https://www.geeksforgeeks.org/print-unique-rows/