Re: [algogeeks] matrix [MS]

2010-10-27 Thread rahul patil
hello all, suppose given matrix contains the 0(white) and 1(black) 0 11100 00100 11100 01100 create the matrix R as follows 1 traverse each row where each cell represents no of continuos balck cells till the current cell 0 12300 00100 12300 01200 similarly creat the matrix C as

Re: [algogeeks] Re: Yahoo coding round question

2010-10-27 Thread ravindra patel
Here is a simple implementation. Complexity O(n). Please let me know if you find any issues with this. Assumptions as stated in original problem - 1- Required sub array is contiguous 2- Given array has only integers (+ve and -) // Params are array arr, length of array n, given sum and product