Skip to content

Graph - 1#791

Open
shinjaneegupta wants to merge 1 commit intosuper30admin:masterfrom
shinjaneegupta:master
Open

Graph - 1#791
shinjaneegupta wants to merge 1 commit intosuper30admin:masterfrom
shinjaneegupta:master

Conversation

@shinjaneegupta
Copy link
Copy Markdown

No description provided.

@super30admin
Copy link
Copy Markdown
Owner

Find the town Judge (FindJudge.py)

Your solution is excellent. It correctly implements the algorithm and efficiently solves the problem. The code is well-structured and easy to understand. You have also correctly analyzed the time and space complexity.

One minor suggestion: In the comment, you mentioned "losing trust (out-degree) subtracts, gaining trust (in-degree) adds." This is accurate, but note that the array indegrees is actually storing a net trust score (in-degree minus out-degree). So it might be more precise to call it a "trust score" or "net trust" array. However, the variable name indegrees is conventional and acceptable.

Another point: The problem constraints state that n can be up to 1000, and the trust array can have up to 10,000 elements. Your solution handles these constraints efficiently.

Overall, great job!

VERDICT: PASS


Ball in the Maze (TheMaze.py)

Your solution is well-implemented and efficient. You have correctly used BFS to traverse the maze, rolling the ball until it hits a wall and then checking if the stopping point is the destination. The in-place marking of visited cells with -1 is a good optimization to avoid cycles.

One improvement: Avoid using dir as a variable name since it is a built-in function in Python. Consider renaming it to something like d or direction to prevent potential conflicts. For example, change:

for dir in self.dirs:

to

for d in self.dirs:

or

for direction in self.dirs:

Other than that, your code is clean and follows best practices. Keep up the good work!

VERDICT: PASS

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