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

Описание к видео 2192. All Ancestors of a Node in a Directed Acyclic Graph | graph | leetcode daily challenge | Hindi

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:
https://leetcode.com/problems/all-anc...

Java Plus DSA Placement Course Playlist:
   • Java and DSA Course Playlist : Online...  

Java Plus DSA Sheet:
https://docs.google.com/spreadsheets/...

Notes:
https://github.com/Tiwarishashwat/Jav...

Telegram Link:
https://shashwattiwari.page.link/tele...

Ultimate Recursion Series Playlist:
   • Recursion and Backtracking Ultimate S...  

Instagram Handle: (@shashwat_tiwari_st)
https://shashwattiwari.page.link/shas...

Samsung Interview Experience:
   • I cracked Samsung | SRIB Interview Ex...  

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​

Комментарии

Информация по комментариям в разработке