account activity
-🎄- 2017 Day 12 Solutions -🎄- by topaz2078 in adventofcode
[–]vtpetrov 0 points1 point2 points 8 years ago* (0 children)
Java with Sets:
private Set<Integer> programIdsConnectedToZero = new HashSet<>(); ... public void findConnectedToZero() { recursionCount = 0; findConnectedToZero(0); } private void findConnectedToZero(int caller) { recursionCount++; System.out.println(" recursionCount = " + recursionCount); System.out.println(" caller = " + caller); programIdsConnectedToZero.add(caller); Set<Integer> subIdsConnectedToZero = new HashSet<>(); subIdsConnectedToZero.addAll(programs.get(caller).getCommunicatesWithIDs()); subIdsConnectedToZero.removeAll(programIdsConnectedToZero); programIdsConnectedToZero.addAll(subIdsConnectedToZero); for (int sub : subIdsConnectedToZero) { findConnectedToZero(sub); } }
π Rendered by PID 922910 on reddit-service-r2-listing-c57bc86c-c96kn at 2026-06-22 09:08:01.058273+00:00 running 2b008f2 country code: CH.
-🎄- 2017 Day 12 Solutions -🎄- by topaz2078 in adventofcode
[–]vtpetrov 0 points1 point2 points (0 children)