算法的重要性,我就不多说了吧,想去大厂,就必须要经过基础知识和业务逻辑面试+算法面试。所以,为了提高大家的算法能力,这个公众号后续每天带大家做一道算法题,题目就从LeetCode上面选 !今天和大家聊的问题叫做 矩阵置零,我们先来看题面:https://leetcode-cn.com/problems/set-matrix-zeroes/Given an m x n matrix. If an element is 0, set its entire row and column to 0. Do it in-place.Follow up:A straight forward solution using O(mn) space is probably a bad idea.A simple improvement uses O(m + n) space, but still not the best solution.Could you devise a constant space solution?题意给定一个 m x n 的矩阵,如果一个元素为 0,则将其所在行和列的所有元素都设为 0。请使用原地算法。样例示例 1:输入: [ [1,1,1], [1,0,1], [1,1,1]]输出: [ [1,0,1
………………………………