Skip to content

Space Optimized solution for 3459. #100

Closed
imankit007 wants to merge 2 commits intowalkccc:mainfrom
imankit007:patch-1
Closed

Space Optimized solution for 3459. #100
imankit007 wants to merge 2 commits intowalkccc:mainfrom
imankit007:patch-1

Conversation

@imankit007
Copy link
Copy Markdown

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.

walkccc and others added 2 commits August 11, 2025 01:35
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.

2 participants