Skip to content

Solving day 23 #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 4, 2025
Merged

Solving day 23 #27

merged 1 commit into from
Jan 4, 2025

Conversation

truggeri
Copy link
Owner

@truggeri truggeri commented Jan 4, 2025

Summary

Solved using two data structures,

  1. A map keyed on a computer identifier and containing a slice (vector, list) of all the connected machines.
  2. A map keyed on the connection between two computers and containing true

This allows us to iterate through ever computer connected to a t computer and in O(1) time look up if those computers are connected. The tricky bit is identifying double or triple counts.

@truggeri truggeri self-assigned this Jan 4, 2025
@truggeri truggeri merged commit 651ab98 into main Jan 4, 2025
1 check passed
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.

1 participant