Given a matrix of characters containing only lowercase letters, form a new string from the matrix that remain after removing the duplicate characters from each row and column. The remaining characters are joined row-wise to form the string.
Input : Matrix of characters (Or array of strings) aabcd effgh iijkk lmnoo pqqrs ttuvw xxyyz Output : bcdeghjlmnprsuvwz The characters that appear more than once in their row or column are removed. Input : zx xz Output :zxxz
Approach : Traverse the entire matrix and for every element, check its corresponding row and column. If there are duplicates, then mark that particular cell in another matrix as true. Finally, all the characters for which there is false value in another matrix are joined to form the string.
- Count Negative Numbers in a Column-Wise and Row-Wise Sorted Matrix
- Count zeros in a row wise and column wise sorted matrix
- Search in a row wise and column wise sorted matrix
- Row-wise vs column-wise traversal of matrix
- Sort the matrix row-wise and column-wise
- Check if the given matrix is increasing row and column wise
- Count number of islands where every island is row-wise and column-wise separated
- Check if a grid can become row-wise and column-wise sorted after adjacent swaps
- Kth smallest element in a row-wise and column-wise sorted 2D array | Set 1
- Print all elements in sorted order from row and column wise sorted matrix
- heapq in Python to print all elements in sorted order from row and column wise sorted matrix
- Replace minimal number of characters to make all characters pair wise distinct
- Character replacement after removing duplicates from a string
- Ways of transforming one string to other by removing 0 or more characters
- Reduce the string by removing K consecutive identical characters
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.