Tutorials
Courses
Data Structure
Java
Python
HTML
Interview Preparation
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Similar Topics
Web Technologies
32.7K+ articles
DSA
20.1K+ articles
Misc
7.8K+ articles
Mathematical
5.1K+ articles
Tree
914+ articles
Recursion
598+ articles
Graph
570+ articles
BFS
228+ articles
Tree Traversals
106+ articles
n-ary-tree
94+ articles
DFS
359+ posts
Recent Articles
Popular Articles
Min Length String with All Substrings of Size N
Last Updated: 28 April 2025
Given two integers n and k, your task is to find a string of minimum length to contain all possible strings of size n as a substring. The characters of the string should b...
read more
Strings
Greedy
Picked
Geeks Premier League
DSA
DFS
Geeks Premier League 2023
Optimal Tree Connectivity
Last Updated: 15 January 2024
Given an undirected tree consisting of n vertices and n-1 edges. The task is to add the minimum number of edges in such a way that the length of the shortest path from ver...
read more
Picked
DSA
DFS
Algorithms-Dynamic Programming
Geeks Premier League 2023
Find the path from root to a vertex such that all K vertices belongs to this path or 1 distance away
Last Updated: 17 January 2024
Given a tree consisting of N vertices numbered from 1 to N rooted at vertex 1. You are given Q queries. Each query consists of the set of K distinct vertices vi[1], vi[2],...
read more
Picked
DSA
DFS
Geeks Premier League 2023
Find Edge Weights in a Spanning Tree with Edge (u, v)
Last Updated: 16 February 2024
Given an undirected weighted graph with N nodes and M edges, the task is for each edge (u, v) find the minimum possible weight of the Spanning Tree which contains the edge...
read more
Picked
DSA
Trees
Kruskal'sAlgorithm
DFS
LCA
Geeks Premier League 2023
Expected number of coins after K moves
Last Updated: 09 April 2024
Given an undirected graph of V nodes and E edges and an array coins[] of size V, such that coins[i] = number of coins present at ith node. Initially, choose any node unifo...
read more
Graph
Dynamic Programming
Geeks Premier League
DSA
DFS
Data Structures
Geeks Premier League 2023
Subtree with exactly K primes
Last Updated: 09 March 2024
Given a tree with N nodes and (N - 1) edges, where the nodes are assigned values from 1 to N, and the root node is 1. The task is to determine if there exists a subtree wi...
read more
Graph
DSA
sieve
DFS
Time and Space Complexity of Depth First Search (DFS)
Last Updated: 04 May 2025
The Depth First Search (DFS) algorithm is used to traverse a graph. It starts with a given source node and explores as far as possible along each branch before backtrackin...
read more
DSA
DFS
Count of nodes at a distance K for every node
Last Updated: 15 April 2024
Given a tree of N vertices and a positive integer K. The task is to find the count of nodes at a distance K for every node.Examples:Input: N = 5, K = 2, edges[][] = {{1, 2...
read more
DSA
DFS
CSES Solutions - Grid Paths
Last Updated: 11 April 2024
There are 88418 paths in a 7x7 grid from the upper-left square to the lower-left square. Each path corresponds to a 48-character description consisting of characters D (do...
read more
Competitive Programming
Picked
DFS
CSES Problems
Maximum Number of Accepted Invitations to Party
Last Updated: 15 April 2024
Given a grid of m boys and n girls, where grid[i][j] = 1 represents that ith boy can invite girl jth girl to party. Each boy can invite only one girl and each girl can acc...
read more
Graph
Picked
DSA
Google
DFS
Time and Space Complexity of DFS and BFS Algorithm
Last Updated: 28 March 2024
The time complexity of both Depth-First Search (DFS) and Breadth-First Search (BFS) algorithms is O(V + E), where V is the number of vertices and E is the number of edges ...
read more
Analysis of Algorithms
Picked
DSA
BFS
DFS
Data Structures and Algorithms-QnA
Find Maximum Subtree of the Same Color
Last Updated: 30 April 2024
Given a 2D integer array edges[] representing a tree with n nodes, numbered from 0 to n - 1, rooted at node 0, where edges[i] = [ui, vi] means there is an edge between the...
read more
Graph
Picked
DSA
Microsoft
DFS
Count Number of Nodes Equal to Sum of Descendants
Last Updated: 14 June 2024
Given the root of a binary tree. The task is to return the number of nodes where the value of the node is equal to the sum of the values of its descendants. A descendant o...
read more
Tree
Picked
DSA
Amazon
DFS
Depth First Search or DFS on Directed Graph
Last Updated: 09 August 2024
Depth-First Search (DFS) is a basic algorithm used to explore graph structures. In directed graphs, DFS can start from a specific point and explore all the connected nodes...
read more
DSA
DFS
Uber's Online Test Experience
Last Updated: 09 October 2024
Online test problems excite some people and make others very nervous. A fascinating challenge popped up in the Uber online test: Participants had to find the shortest path...
read more
Interview Experiences
Shortest Path
DFS
Uber
Experiences
CPP-DSA
1
2
3
4
...
24
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !