@Ramakant : i guess you shud include diagonal case also .... for each arr[i][j] if(arr[i][j]==1) { if (!(arr[i-1][j]==1 || arr[i][j-1]==1 || arr[i-1][j-1])) count++; }
On Tue, Jan 10, 2012 at 9:33 AM, Ramakant Sharma <ramakant...@gmail.com>wrote: > Scan the matrix row wise left to right........ > for each arr[i][j] > if(arr[i][j]==1) > { > if (!(arr[i-1][j]==1||arr[i][j-1]==1)) > count++; > } > ///also chk for baundary values accordingly > > > > > 1 1 0 0 > 1 1 0 0 > 0 0 1 1 > > > i think it should work.. > > -- > 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.