• Tutorials
  • DSA
  • Data Science
  • Web Tech
  • Courses
November 18, 2023 |270 Views

PROBLEM OF THE DAY : 09/11/2023 | Predict the Column

  Share   Like
Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Karan. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of how to predict column but also build up problem-solving skills.

In this problem, we are given, a matrix(2D array) M of size N*N consisting of 0s and 1s only. The task is to find the column with maximum number of 0s. If more than one column exists, print the one which comes first. If the maximum number of 0s is 0 then return -1.

Example:

Input:
N = 3
M[][] = {{0, 0, 0},
         {1, 0, 1},
         {0, 1, 1}}
Output: 0

Explanation:
0th column (0-based indexing) is having 2 zeros which is maximum among all columns and comes first.

Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems-preview/predict-the-column/1
Solution link: https://ide.geeksforgeeks.org/online-cpp-compiler/b02c1db3-5aa4-4e4f-9968-02089aef754c