542. 01 Matrix

follow template style

time: O(mn)

space: O(mn)

Use some tricks

use MAX to represent 1 and not visited, update 1's value to dist (but I think it's not different)

just save some space, time is the same

latest one:

Last updated

Was this helpful?