Matrix problem(Contest)
Matrix problem easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Matrix problem easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Problem Statement :
Given a binary square matrix of size N*N and an integer K, your task is to print the maximum side of sub square matrix containing at most K 1's. Input The first line of input contains two integers N and K, Next N lines contain N space-separated integers depicting the values of the matrix.
Constraints: 1 < = N < = 500 1 < = K < = 100000 0 < = Matrix[][] < = 1 Output Print the maximum side. Example Sample Input:- 3 2 1 1 1 1 0 1 1 1 0
Sample Output:- 2
Explanation:- 0 1 1 0 is the required sub matrix.
Sample Input:- 2 1 1 0 0 1
Sample Output:- 1
link: