M
MIA
Hi,
I have an nxn array in which in each row is consisting of +ve and -ve
numbers, such that -ve number comes before +ve numbers. e.g.
-45 | -9 | -3 | 2
===================
-5 | -9 | 21 | 12
===================
-4 | 19 | 18 | 5
===================
-15 | -17 | 38 | 3
all I have to do is to find the row with max number of +ve integers.
in the above case 3rd row.
My problem is that I have to make algorithm linear i.e. O(n) instead
of O(n^2).
any sugestions.
I have an nxn array in which in each row is consisting of +ve and -ve
numbers, such that -ve number comes before +ve numbers. e.g.
-45 | -9 | -3 | 2
===================
-5 | -9 | 21 | 12
===================
-4 | 19 | 18 | 5
===================
-15 | -17 | 38 | 3
all I have to do is to find the row with max number of +ve integers.
in the above case 3rd row.
My problem is that I have to make algorithm linear i.e. O(n) instead
of O(n^2).
any sugestions.