{"payload":{"feedbackUrl":"https://github.com/orgs/community/discussions/53140","repo":{"id":585469386,"defaultBranch":"main","name":"basic-of--java-coding-ninja","ownerLogin":"geniusrks1","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2023-01-05T08:51:02.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/105981384?v=4","public":true,"private":false,"isOrgOwned":false},"refInfo":{"name":"","listCacheKey":"v0:1672908668.566695","currentOid":""},"activityList":{"items":[{"before":"caddebe97b7308dccb194ca734ed14febd77277f","after":"6818f0c2d218b41e61369ec029aedc189d3a7369","ref":"refs/heads/main","pushedAt":"2024-02-14T13:10:43.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"geniusrks1","name":"ROHIT KUMAR","path":"/geniusrks1","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/105981384?s=80&v=4"},"commit":{"message":"Create Set Matrix Zeros.java\n\nGiven an ‘N’ x ‘M’ integer matrix, if an element is 0, set its entire row and column to 0's, and return the matrix. In particular, your task is to modify it in such a way that if a cell has a value 0 (matrix[i][j] == 0), then all the cells of the ith row and jth column should be changed to 0.\r\nYou must do it in place.\r\nFor Example:\r\nIf the given grid is this:\r\n[7, 19, 3]\r\n[4, 21, 0]\r\n\r\nThen the modified grid will be:\r\n[7, 19, 0]\r\n[0, 0, 0]\r\nInput Format:\r\nThe first line of the input contains a single integer ‘T’ representing the no. of test cases.\r\n\r\nThe first line of each test case contains two space-separated integers ‘N’ and ‘M’, denoting the no. of the rows and columns of the matrix.\r\n\r\nThe next 'N' lines will contain ‘M’ space separated integers representing the elements of the matrix.\r\nOutput Format:\r\nFor each test case, print the modified grid.\r\n\r\nPrint output of each test case in a separate line.\r\nNote:\r\nYou are not required to print anything; it has already been taken care of. Just implement the function and return the answer.\r\nConstraints:\r\n1 ≤ T ≤ 1000\r\n1 ≤ m, n ≤ 1000\r\nΣ(m * n) ≤ 2000000\r\n-2^(31) ≤ matrix[i][j] ≤ 2^(31)-1, for all (1 ≤ i ≤ n and 1 ≤ j ≤ m).\r\n\r\nTime Limit: 1 sec\r\nFollow up:\r\nCan we do better than O(m * n) space?\r\nUsing O(m + n) space is an improvement but we can still do better.\r\nWe can do it using constant memory. Can you do it?\r\nSample Input 1 :\r\n2\r\n2 3\r\n7 19 3\r\n4 21 0\r\n3 3\r\n1 2 3\r\n4 0 6\r\n7 8 9\r\nSample Output 1 :\r\n7 19 0\r\n0 0 0\r\n1 0 3\r\n0 0 0\r\n7 0 9\r\nExplanation For Sample Input 1 :\r\nFor First Case - Similar to the example explained above. \r\n\r\nFor Second Case - \r\nOnly the cell (2,2) has zero. So all the elements of the second row and second column are changed to zeros.\r\nSample Input 2 :\r\n2\r\n4 2\r\n1 0\r\n2 7\r\n3 0\r\n4 8\r\n3 3\r\n0 2 3\r\n1 0 3\r\n1 2 0\r\nSample Output 2 :\r\n0 0\r\n2 0\r\n0 0\r\n4 0\r\n0 0 0\r\n0 0 0\r\n0 0 0","shortMessageHtmlLink":"Create Set Matrix Zeros.java"}}],"hasNextPage":false,"hasPreviousPage":false,"activityType":"all","actor":null,"timePeriod":"all","sort":"DESC","perPage":30,"cursor":"djE6ks8AAAAD-o5SqAA","startCursor":null,"endCursor":null}},"title":"Activity · geniusrks1/basic-of--java-coding-ninja"}