Skip to content

Conversation

imankit007
Copy link

Changes:
Change DP state to 4D.
Remove variable hashNum in function dfs.

Description:
The value of grid[i][j] does not need to be included as a DP state variable because it does not change during iteration. This reduction in dimensionality improves space complexity. The existing solution exceeds the time limit on some test cases.

Changes:
Change DP state to 4D.
Remove variable hashNum in function dfs.

Description: 
The value of grid[i][j] does not need to be included as a DP state variable because it does not change during iteration.
This reduction in dimensionality improves space complexity.
The existing solution exceeds the time limit on some test cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant