Test cases
|
|
Solution 1: accepted 2ms
DP: do we really need to create another grid? Nope.
Time: O(mn)
Space: O(2mn)
|
|
Solution 2: accepted 2ms
Time: O(mn)
Space: O(mn)
|
|
|
|
DP: do we really need to create another grid? Nope.
Time: O(mn)
Space: O(2mn)
|
|
Time: O(mn)
Space: O(mn)
|
|