"DFS-1 done"#1406
Open
Sahithipsl470 wants to merge 1 commit intosuper30admin:masterfrom
Open
Conversation
Owner
Flood Fill the image (Problem-1.py)Your solution correctly implements the flood fill algorithm using DFS recursion. Here are some strengths and areas for improvement: Strengths:
Areas for Improvement:
Example of iterative DFS using stack: def floodFill(self, image, sr, sc, color):
if image[sr][sc] == color:
return image
original_color = image[sr][sc]
stack = [(sr, sc)]
while stack:
r, c = stack.pop()
if image[r][c] != original_color:
continue
image[r][c] = color
for dr, dc in [(1,0), (-1,0), (0,1), (0,-1)]:
nr, nc = r + dr, c + dc
if 0 <= nr < len(image) and 0 <= nc < len(image[0]):
stack.append((nr, nc))
return imageThis iterative approach is similar to the reference solution (which uses BFS) and avoids recursion depth issues. VERDICT: PASS Nearest zero (Problem-2.py)Your solution is well-implemented and efficient. You have correctly used a dynamic programming approach with two passes to solve the problem. The code is clean and easy to understand, and you have provided helpful comments. Strengths:
Areas for Improvement:
Overall, this is a great solution. Keep up the good work! VERDICT: PASS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.