hi i have one doubt if negative by 1 in a row if any element got zero and again doing same operation to get another element to be zero so 1st element is negative so could u please tell me the matrix automatically do the positive value else as it. if it is negative then ans is No, we will not get O matrix(one with all zeroes in it.) else there have some solution to get O matrix.
On Wed, Aug 26, 2009 at 12:13 AM, ankur aggarwal <ankur.mast....@gmail.com>wrote: > I've always wanted to feel the excitement in these interviews. I got a > chance, and I liked it. > > Here is the question: > > You are given a matrix: r rows, c cols. r x c matrix. > > Now they all have positive integers. Assume that the computer has no > overflow, it can store all possible integer values. > > Now there are only two operations you can perform on the matrix: > > a. Multiply one whole column (of size r elements) by 2 aij = aij * 2 > b. Decrement a whole row (of size c elements) by 1. aij = aij - 1 > > Now you are required to find out if it's possible with these operations to > convert this matrix into the O matrix. (one with all zeroes in it.) > > If so, how do you solve it? Or when do you decide to terminate? > > give the algo.. > not the code. > > > > -- Thanks & Regards Umesh kewat IIIT-Hyderabad --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---