Programming Competition and Programming Interview questions. And maybe some web stuff, too.
Book: Cracking the Coding Interview Question: 1.7 (page 73)
Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column are set to 0.
Solution: Complexity - O(M*N), Space - O(M+N)
No comments:
Post a Comment