Tutti Nuovi

user:thomas utente che ha creato il gist

title:mygist titolo del gist

description:sync gists with given description

filename:myfile.txt nome di file nel gist

extension:yml estensione del file nel gist

language:go linguaggio del file nel gist

topic:homelab Gist con l'argomento dato

all:systemctl search all fields

Registrati

Entra

Tutti Nuovi Registrati Entra

linkjobai

Unito 5 days ago

Più recente creazione
Meno recente creazione
Più recente aggiornamento
Meno recente aggiornamento
Tutti i gists 1

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

0 mi piace
0 forks
1 files
Ultima volta attivo 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)

Più nuovi Più vecchi

Creato da Opengist ⋅ Load: 37ms⋅

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