yes 2^((n-1)^2) is the answer :) consider a row or column of size n, Number of ways it can we filled with 1's and -1's(such that product is 1) is sum of all nCi where i = 0,2,4..... (i = no of -1s) and that will be 2^(n-1) (same is the number when product is -1 ) so now let f(i,j) is the number of ways to fill the matrix of size i,j then f(i,j) = 2^(i-2)*2^(j-2)*f(i-1)(j-1)*2 where f(1,1) = 1;
explanation for f(i,j) matrix of size (i,j) can be broken into four parts = matrix of size(i-1,j-1) + jth column of size i-1+ ith row of size (j-1) + element at[i,j] so ans is number of ways matrix [i-1][j-1] can be filled is f(i,j) multiplied with when both row and col are 1 and element is 1 or both row and col are -1 and ele is -1 solving the equation for f(n,n) will give 2^((n-1)^2) @skript my method is little bit complex........how did u arrived at solution.....is there a simple way to get to the same answer? On Thu, Jul 28, 2011 at 12:11 PM, sunny agrawal <sunny816.i...@gmail.com>wrote: > @Hemlatha > this is one of the possible solution > > the Question is to find Number of such solutions > > On Thu, Jul 28, 2011 at 12:09 PM, Hemalatha < > hemalatha.amru...@googlemail.com> wrote: > >> Give all the primary and secondary diagonal Elements a value -1 and the >> rest as 1s. >> >> -1 1 1 1 1 -1 >> 1 -1 1 1 -1 1 >> 1 1 -1 -1 1 1 >> 1 1 -1 -1 1 1 >> 1 -1 1 1 -1 1 >> -1 1 1 1 1 -1 >> >> >> Regards >> Hemalatha >> >> >> On Thu, Jul 28, 2011 at 11:29 AM, priyanka goel >> <priya888g...@gmail.com>wrote: >> >>> @ SkRiPt... >>> can u pl explain ur ans? >>> >>> -- >>> 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. >> > > > > -- > Sunny Aggrawal > B-Tech IV year,CSI > Indian Institute Of Technology,Roorkee > > -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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.