Jumping the queue? Yes, but in constant time
The Problem
Classic interview setup: you walk in, sit down, and the interviewer says:
“Design a
FastQueueclass. It stores entries, where each entry has along idand aString family.You need three operations, all in O(1) time:
add(entry),removeLast(), andremoveLast(family).Space complexity is O(N) for all operations.”
Let’s unpack that. You have a queue of entries, each tagged with a family group. At any point, you can eject the oldest entry within a given family, all in constant-time.
JUnit 5 Tricks Recap
JUnit: Lay of the Land & Mutation testing
Alright, what do we know about unit tests?
- A unit test verifies an individual unit of code works as expected,
- It is small, fast and isolate a single functionality
They are generally named based on what the test verifies, e.g. testInvalidAccountIdThrowsException; they are independent
from each other even though grouped in the
same class as related tests.
We create them in the same package structure as the source code but under the src/test/java directory. With Maven,
tests can be run using lifecycle phases like test, install, etc.
Bron to Clique
Discovery of Bron-Kerbosch in AoC24-23
For part 2 of this challenge, I am actually ashamed of showing here what I initially tried to program without knowing what a clique was, nor that an algorithm existed to find the maximal cliques in a graph… Maybe one day when I add a Premium Pass to this blog, a few privileged users could see the pépite.

Part 1 - the piece of 🍰
As The Historians wander around a secure area at Easter Bunny HQ, you come across posters for a LAN party scheduled for today!
Maybe you can find it; you connect to a nearby datalink port and download a map of the local network (your puzzle input).
The network map provides a list of every connection between two computers. For example:
kh-tc
qp-kh
de-cg
ka-co
Each line of text in the network map represents a single connection; the line kh-tc represents a connection between the
computer named kh and the computer named tc. Connections aren't directional; tc-kh would mean exactly the same thing.
LAN parties typically involve multiplayer games, so maybe you can locate it by finding groups of connected computers.
Start by looking for sets of three computers where each computer in the set is connected to the other two computers.
If the Chief Historian is here, and he's at the LAN party, it would be best to know that right away. You're pretty
sure his computer's name starts with t, so consider only sets of three computers where at least one computer's name
starts with t. That narrows the list down to 7 sets of three inter-connected computers:
co,de,ta
co,ka,ta
de,ka,ta
qp,td,wh
tb,vc,wq
tc,td,wh
td,wh,yn
Find all the sets of three inter-connected computers. How many contain at least one computer with a name that starts
with t?
Initial Thoughts
Setting the “starts with t” requirement aside, the list of computers given is a list of edges connecting two computers (nodes).