HackerEarth Binary Matrix problem solution - TheCScience