Alle Neu

user:thomas Gists erstellt von Nutzer

title:mygist Gists mit Titel

description:sync gists with given description

filename:myfile.txt Gists mit Dateinamen

extension:yml Gists mit Dateiendung

language:go Gists in Sprache

topic:homelab gists zum gegebenen Thema

all:systemctl search all fields

Registrieren

Anmelden

Alle Neu Registrieren Anmelden

linkjobai

Beigetreten 5 days ago

Neueste erstellt
Älteste erstellt
Neueste bearbeitet
Älteste bearbeitet
Alle Gists 1

linkjobai / Topological Sort in Coding Interviews: Kahn's Algorithm Explained

0 Favoriten
0 Forks
1 Dateien
Zuletzt aktiv 5 days ago
Interview prep notes
interview

Topological Sort in Coding Interviews: Kahn's Algorithm Explained

Problems like Course Schedule (LeetCode 207/210), Alien Dictionary and build-order questions are all the same idea: you have tasks with "must happen before" rules, and you need a valid order (or proof that none exists).

The idea in one sentence

Repeatedly take a node with no remaining prerequisites (in-degree 0), output it, and remove its outgoing edges.

Python template (Kahn's algorithm)

Neuer Älter

Powered by Opengist ⋅ Load: 36ms⋅

Deutsch
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文