Skip to content

Comments

Graph-1 solutions#784

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

Graph-1 solutions#784
dbkuppagiri wants to merge 1 commit intosuper30admin:masterfrom
dbkuppagiri:master

Conversation

@dbkuppagiri
Copy link

No description provided.

@super30admin
Copy link
Owner

Your solution for "Find the town Judge" is correct and efficient. Well done! The logic is sound and the code is clean. However, I have a few suggestions for improvement:

  • Variable Naming: Consider renaming inOrder to something more descriptive like trustScores or netTrust. The current name doesn't convey the purpose of the array.
  • Indexing: You are using 0-indexed array for people labeled 1 to n. This is acceptable, but be cautious about off-by-one errors. Alternatively, you could create an array of size n+1 (index 0 unused) to match the person labels directly, which might make the code slightly more readable.
  • Comments: Your intuition comment is helpful, but you could add inline comments to explain the decrement and increment operations for clarity.

Regarding the inclusion of hasPath.js: This seems to be a solution for a different problem. When submitting solutions, ensure that you only provide the code for the problem being evaluated.

Overall, your solution for the town judge problem is excellent.

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.

3 participants