Tümü Yeni

user:thomas kullanıcı tarafından oluşturulan gistler

title:mygist belirtilen isme sahip gistler

description:sync gists with given description

filename:myfile.txt belirtilen isimde dosyaları olan gistler

extension:yml belirtilen uzantıya sahip dosyalara sahip gistler

language:go belirtilen dilde dosyaları olan gistler

topic:homelab Verilen konuyla ilgili gist'ler

all:systemctl search all fields

Kaydol

Giriş

Tümü Yeni Kaydol Giriş

linkjobai

Katıldı 5 days ago

Yakın zamanda oluşturuldu
En eski oluşturuldu
Yakın zamanda güncellendi
En eski güncellendi
Tüm gistler 1

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

0 beğeniler
0 çatallar
1 dosyalar
Son aktivite 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)

Daha yeni Daha eski

Opengist tarafından desteklenmektedir ⋅ Load: 36ms⋅

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