Тёмный

2192. All Ancestors of a Node in a Directed Acyclic Graph | graph | leetcode daily challenge | Hindi 

shashCode
Подписаться 15 тыс.
Просмотров 784
50% 1

Problem Name:
2192. All Ancestors of a Node in a Directed Acyclic Graph
Problem Statement:
You are given a positive integer n representing the number of nodes of a Directed Acyclic Graph (DAG). The nodes are numbered from 0 to n - 1 (inclusive).
You are also given a 2D integer array edges, where edges[i] = [fromi, toi] denotes that there is a unidirectional edge from fromi to toi in the graph.
Return a list answer, where answer[i] is the list of ancestors of the ith node, sorted in ascending order.
A node u is an ancestor of another node v if u can reach v via a set of edges.
Problem link:
leetcode.com/problems/all-anc...
Java Plus DSA Placement Course Playlist:
• Java and DSA Course Pl...
Java Plus DSA Sheet:
docs.google.com/spreadsheets/...
Notes:
github.com/Tiwarishashwat/Jav...
Telegram Link:
shashwattiwari.page.link/tele...
Ultimate Recursion Series Playlist:
• Recursion and Backtrac...
Instagram Handle: (@shashwat_tiwari_st)
shashwattiwari.page.link/shas...
Samsung Interview Experience:
• I cracked Samsung | SR...
Company Tags:
Facebook | Amazon | Microsoft | Netflix | Google | LinkedIn | Pega Systems | VMware | Adobe | Samsung
Timestamp:
0:00 - Introduction
1:26 - Problem Explanation
4:48 - DFS Approach - 1 Explanation
13:03 - DFS Live Coding
20:35 - DFS Shortcoming
21:25 - Toposort Intro
23:13 - Using toposort in this question?
24:46 - finding ancestors using toposort
28:34 - toposort explanation
35:01 - Code with toposort
#ShashwatTiwari #coding​​ #problemsolving​

Опубликовано:

 

25 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 10   
@yashjain5651
@yashjain5651 26 дней назад
You taught really well. Thanks a lot!
@RohitKumar-dz8dh
@RohitKumar-dz8dh 27 дней назад
Thanks 😊
@shashwat_tiwari_st
@shashwat_tiwari_st 27 дней назад
Like target for this video is 80. Please do like if you have understood the solution.
@PiyushSharma-we8yd
@PiyushSharma-we8yd 27 дней назад
bhaiya, toposort kyu laga kahi aur se samajh nhi aya and baki sbne dfs leetcode editorial wala btaya hai, aapne naya kuch sikhaya. Thanks a lot bhaiya, 1st july se aane wali playlist zeher hone wali hai aaj hi samajh aa gya🤩🤩🤩🤩
@siddharthaarora4351
@siddharthaarora4351 26 дней назад
didnt get this question, i guess need to practice more on this graph thing.
@shashwat_tiwari_st
@shashwat_tiwari_st 27 дней назад
I have tried my best to explain toposort. Hope you all will understand, (use timestamp if you can code dfs and want to skip it).. We have covered Kahn's Algorithm for toposort.
@keshavgupta9174
@keshavgupta9174 27 дней назад
ok shashwat bhaii
@ajringtones9574
@ajringtones9574 27 дней назад
I'm gonna start graph from 1st of July and from the last two days LeetCode is giving graph questions as POTD and today's question is 🥴 BTW thanks for putting such kind of efforts for us
@siddharthaarora4351
@siddharthaarora4351 26 дней назад
can relate thought of doing graphs at last but seems like need to make a change
@RahulSingh-ff2bi
@RahulSingh-ff2bi 26 дней назад
Please upload today problem viedo
Далее
Best Toilet Gadgets and #Hacks you must try!!💩💩
00:49
How Dijkstra's Algorithm Works
8:31
Просмотров 1,3 млн
DARKER SIDE of SOFTWARE ENGINEERING !!
12:09
Просмотров 134 тыс.
Winning Google Kickstart Round A 2020 + Facecam
17:10
Why are you not creating anything in c++ ?
14:46
Просмотров 98 тыс.