Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungThe AI Interview Paradox: Decoupling Skill Assessment from Tool Usage(21.09.2026 um 02:01 Uhr)
Sichere ProgrammierungI Built a 100% Free AI Toolbox with No Sign-Up (Here's How)(21.09.2026 um 02:02 Uhr)
Sichere ProgrammierungUnreal C++ Course Chapter 109(21.09.2026 um 02:02 Uhr)
Sichere ProgrammierungWhen Your Impact Is No Longer Measured in Pull Requests(21.09.2026 um 02:04 Uhr)
Sichere ProgrammierungHow to choose a used FortiGate firewall (without getting burned)(21.09.2026 um 02:18 Uhr)
Sichere ProgrammierungC# basic JsonConverter tip(21.09.2026 um 02:35 Uhr)
KI & AI VideosJulian Goldie SEO: Qwen Image 2.1 is NOW Free! 🤯(21.09.2026 um 02:00 Uhr)
Sichere ProgrammierungThe AI Interview Paradox: Decoupling Skill Assessment from Tool Usage(21.09.2026 um 02:01 Uhr)
Sichere ProgrammierungI Built a 100% Free AI Toolbox with No Sign-Up (Here's How)(21.09.2026 um 02:02 Uhr)
Sichere ProgrammierungUnreal C++ Course Chapter 109(21.09.2026 um 02:02 Uhr)
Sichere ProgrammierungWhen Your Impact Is No Longer Measured in Pull Requests(21.09.2026 um 02:04 Uhr)
Sichere ProgrammierungHow to choose a used FortiGate firewall (without getting burned)(21.09.2026 um 02:18 Uhr)
Sichere ProgrammierungC# basic JsonConverter tip(21.09.2026 um 02:35 Uhr)
KI & AI VideosJulian Goldie SEO: Qwen Image 2.1 is NOW Free! 🤯(21.09.2026 um 02:00 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

AoC '24 Day 8: Resonant Collinearity

Reagiere als Erste:r — dein Feedback zählt!

Day 8: Resonant Collinearity

This one was a lot tougher than it needed to be because the instructions were so poor (common problem people have found on the forums).

You can find my solution at repo

Concept of solution:

In Part 1, the goal is to find pairs of antennas (points), draw a line between them, and place antinodes 1 step away from each antenna along the line.

In Part 2, for each pair of antennas, the code calculates a directional vector and extends the line in both directions, placing antinodes along the line. The line continues until there are no more valid points (e.g off the grid).

Summary of the "How"

Step 1: Gathering All Points in the Antenna Group
The first step is to collect the positions of all antennas into a list (or similar structure). For example, after reading the input data, you might have something like this:

antennas = 
    'A': [(1, 1), (2, 2)]
    'B': [(3, 3), (4, 4)]
    # More antennas...

Step 2: Generating Pairs of Points
Once you have the positions of all the antennas in the group, the goal is to evaluate every possible pair of points to analyse potential lines between them. The code uses the combinations function to do this.

For each valid point along the extended line that exists in the grid, add it to the HashSet.

Step 3 - Finding the Direction

Once the pairs are generated, they are used to define directional vectors (what tells you how to get from one point to another on a grid, using just two numbers: one for the horizontal direction (left/right) and one for the vertical direction (up/down)) and analyse potential alignments or extensions.

Calculate the Directional Vector:
For a pair (P1, P2) where P1 = (x1, y1) and P2 = (x2, y2), the directional vector (dx, dy) is:

dx = x2 - x1
dy = y2 - y1

Why is a Directional Vector Useful?

Movement:
It helps us understand how to move from one point to another. In the case of a grid, moving right would be a positive horizontal direction, and moving up would be a positive vertical direction.

Line Definition:
If you want to draw a straight line between two points, you can use the directional vector to keep moving from one point to the next along the line. By repeatedly adding the directional vector, you can find every point on the line. Imagine an L-Shaped ruler set at the directional vector and slide it to the next pair.

Imagine you have two points on a grid, like:

Point A: (1, 1)
Point B: (4, 5)
To move from Point A to Point B, you need to know:

  • How much to move horizontally (left or right).
  • How much to move vertically (up or down).

The directional vector tells you this. It’s a simple calculation of the difference between the two points.

Calculation of the Directional Vector:
Horizontal direction (left/right): dx = x2 - x1
Vertical direction (up/down): dy = y2 - y1

For our points:
Point A is at (1, 1), and Point B is at (4, 5).

The directional vector is:
dx = 4 - 1 = 3 (move 3 steps to the right).
dy = 5 - 1 = 4 (move 4 steps up).
So, the directional vector from Point A to Point B is (3, 4).

Scaling:
You can scale the directional vector to make it bigger or smaller by multiplying it by a number. For example, multiplying (3, 4) by 2 gives (6, 8), meaning you're moving twice as far in the same direction.

Extend the Line:
The code then attempts to extend the line defined by this pair, checking both forward and backward along the direction defined by (dx, dy) to find possible aligned points (antinodes).

Again, if you wish to reach out drop me a follow, or find me on twitter

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten AoC '24 Day 8: Resonant Collinearity

Thematisch verwandte Begriffe: Resonant, Collinearity · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-93968 | A vulnerability was determined in aiyiyi121 SxDevOps 1.0/1.1. This affec…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick