# Find the longest sequence in a matrix

Hi,I have a problem related to a matrix of 6*7 as below

0 0 0 0 0 0 0

1 0 1 0 1 1 1

0 0 0 1 0 0 0

0 1 0 0 0 0 0

0 0 0 0 0 0 0

1 1 1 1 1 1 1

In above matrix on some position there is 1 and on some position 0 is mentioned. Total position containing 1 is 14.

I need to get the longest sequence of 1 in a horizontal/vertical/diagonal way.

Please help me to solve this problem.

Program should return answer 7(last bottom row containing longest sequence of 1).

Thanks

Anil