You try to set rows and columns to zero immediately while traversing the matrix — which causes incorrect results because new zeroes you just added affect the rest of your traversal.
There is a few test cases which are missing in the question,So write a solution by your own so that it should pass the test cases which are not mentioned there also,,i am writing one test case here ...