Wszystko Nowy

user:thomas Gisty stworzone przez użytkownika

title:mygist Gisty z podanym tytułem

description:sync gists with given description

filename:myfile.txt Gisty zawierające pliki z podanym tytułem

extension:yml Gisty zawierające pliki z podanym rozszerzeniem

language:go Gisty zawierające pliki z podanym językiem

topic:homelab gists with given topic

all:systemctl search all fields

Zarejestruj się

Zaloguj się

Wszystko Nowy Zarejestruj się Zaloguj się

All gists matching topic interview

Ostatnio utworzono
Najdawniej utworzono
Ostatnio zaktualizowano
Najdawniej zaktualizowano

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

0 polubień
0 forków
1 plików
Ostatnio aktywne 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)

Nowsze Starsze

Obsługiwane przez Opengist ⋅ Load: 25ms⋅

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