arpankg/ctci-python-solutions

Solution 1.8 - Incorrect output matrix

krazeelazy opened this issue · 1 comments

The output matrix should be:
[
[1, 0, 3, 0],
[0, 0, 0, 0],
[6, 0, 1, 0],
[0, 0, 0, 0]
]
instead of
[
[1,0,3,4],
[5,0,7,8],
[6,0,1,2],
[0,0,0,0]
]

row 2 (matrix[1]) becomes 0 because matrix[1][1] (item next to 5 in second row) is 0 and the last column becomes 0 because the last item in the column is 0.

Thank you for pointing that out! Not sure how I missed that lol. Fixed the error. Thanks!