@dave wats d logic behind ur code

Ashima
M.Sc.(Tech)Information Systems
4th year
BITS Pilani
Rajasthan




On Wed, Aug 31, 2011 at 9:05 AM, Dave <dave_and_da...@juno.com> wrote:

> @Manish:
>
> for( i = 1 ; i < n ; ++i )
>    for( j = 1 ; j < m ; ++j )
>        if( a[i][j] != 0 )
>            a[i][0] = a[0][j] = 1;
> for( i = 1 ; i < n ; ++i )
>    for( j = 1 ; j < m ; ++j )
>        if( a[i][0] + a[0][j] != 0 )
>            a[i][j] = 1;
>
> Dave
>
> On Aug 31, 8:40 am, manish kapur <manishkapur.n...@gmail.com> wrote:
> > Input is a matrix of size n x m of 0s and 1s.
> >
> > eg:
> > 1 0 0 1
> > 0 0 1 0
> > 0 0 0 0
> >
> > If a location has 1; make all the elements of that row and column = 1. eg
> >
> > 1 1 1 1
> > 1 1 1 1
> > 1 0 1 1
> >
> > Solution should be with Time complexity = O(n*m) and O(1) extra space
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to