title: Given a binary matrix of 0 and 1. Find the longest sequence of 1's either row wise or column wise
body: <p>Given a binary matrix of 0 and 1. Find the longest sequence of 1's either row wise or column wise.
  For example:</p>
  
  <p>0 0 0 1 0 0 </p>
  
  <p>0 0 1 1 0 0</p>
  
  <p>0 0 0 1 0 0</p>
  
  <p>It should return highest count – 3.
  Help, write this program on js</p>
  
  <pre><code>  var cols = prompt("input cols", 4);
    var rows = prompt("input rows", 4);
    var arr = [];
  
    for (var i = 0; i &lt; rows; i++) {
        arr[i] = [];
  
        for (var j = 0; j &lt; cols; j++) {
            var rand = Math.round(Math.random() * 1);
            arr[i][j] = rand;
        }
    }
  
    console.log(arr);
  
    var str = arr.join('\n');
    console.log(str);
  
    var List = str.split(0);
     //----there is a code for  continuous sequence
    var max = 0;
    var array = str.split('1').forEach(function (item) {
        if (max &lt; item.length) max = item.length;
    })
  </code></pre>
  
  <p>How to search by rows and columns to find an uninterrupted sequence</p>