int max_ones(int mat[N][N])
{
int r = 0, c = 0;
while(r < N) {
if(c < N && mat[r][c] == '1')
++c;
else
++r;
}
return c;
}
On Dec 27, 3:24 am, jyoti saini <[email protected]> wrote:
> A NxN matrix is given containing only 1’s and 0’s. Every row is sorted in
> descending order. Find the row containing maximum no. of ones.
> time complexity-O(n);
> --
>
> Jyoti Saini.
> B.Tech-Final year.
> Information Technology.
> National Institute of Technology,Kurukshetra.
> Alt Email [email protected] <[email protected]>
> +91-9813799528,+91-8030776217, 0172-4635398.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.