Largest Color Value in a Directed Graph - LeetCode 1857 - Python

preview_player
Показать описание
Code & Solution Blog: (sign into leetcode for it)

LeetCode Problem Link:
Рекомендации по теме
Комментарии
Автор

This deserves way more views than what it has. This is the best algorithm I've found explained on YouTube for this problem. Thanks a lot! Keep it up :)
edit: although I would suggest a slight edit by popping the first element (queue.pop(0)) from the queue instead of the last element (queue.pop() which defaults to index -1, making the queue behave like a stack). Your current code mimics a DFS instead of Kahn's BFS approach.

SARABRIKI-gp