Tous Nouveau

user:thomas gists créés par un utilisateur

title:mygist gists avec un titre spécifique

description:sync gists with given description

filename:myfile.txt gists qui ont des fichiers avec un nom spécifique

extension:yml gists qui ont des fichiers avec une extension spécifique

language:go gists qui ont des fichiers écrits en un langage spécifique

topic:homelab gists with given topic

all:systemctl search all fields

Inscription

Connexion

Tous Nouveau Inscription Connexion

All gists matching topic interview

Récemment créé
Le moins récemment créé
Récemment mis à jour
Le moins récemment mis à jour

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

0 j'aimes
0 forks
1 fichiers
Dernière activité 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)

Plus récent Plus ancien

Propulsé par Opengist ⋅ Load: 33ms⋅

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