Open
Conversation
kyra-patton
reviewed
Jul 24, 2022
Comment on lines
+9
to
+10
| Time Complexity: ? | ||
| Space Complexity: ? |
Comment on lines
+17
to
+18
| group_1 = 0 | ||
| group_2 = 1 |
There was a problem hiding this comment.
Consider making all caps, as you use these as constants
Suggested change
| group_1 = 0 | |
| group_2 = 1 | |
| GROUP_1 = 0 | |
| GROUP_2 = 1 |
| groups[start_dog] = group_1 | ||
| queue = deque() | ||
| queue.append(start_dog) | ||
| while queue: |
kyra-patton
reviewed
Jul 25, 2022
kyra-patton
left a comment
There was a problem hiding this comment.
🐾🐶 Overall nice implementation Mac. It looks like you got your logic a bit backwards at one point, but overall it seems like you have a good understanding of BFS. I'm marking this as a yellow since the time and space complexity are missing and not all of the tests are passing. Feel free to update to receive a green score.
Let me know what questions you have.
🟡
| for disliked_dog in dislikes[curr_dog]: | ||
| if groups[disliked_dog] is None: | ||
| groups[disliked_dog] = ( | ||
| group_1 if groups[curr_dog] == group_1 else group_2 |
There was a problem hiding this comment.
🤔 I think you mixed up your logic a bit here. If the current dog is in group_1 then you want the disliked dog to be in group_2.
Suggested change
| group_1 if groups[curr_dog] == group_1 else group_2 | |
| group_2 if groups[curr_dog] == group_1 else group_1 |
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.