Graphs
37 problems to practice.
Sentence Similarity
1. You will be given two sentences in form of array of string 2. You will also be given a 2d array...
Redundant Connection
1. You are given a 2D-array of edges. Each element of edges is a pair [u, v] with u < v, that repres...
Alien Dictionary
1.Given a sorted dictionary of an alien language having N words and k starting alphabets of standard...
Bellman Ford
You are given 2 integers N and M , N is the number of vertices, M is the number of edges. You'll als...
Negative Weight Cycle Detection
You are given 2 integers N and M , N is the number of vertices, M is the number of edges. You'll als...
Pepcoder And Reversing
You are given 2 integers N and M , N is the number of vertices, M is the number of edges. You'll als...
Pepcoding Course Schedule
Pepcoding offers total of n courses labelled from 0 to n-1. Some courses may have prerequisites....
Kosaraju Algorithm
You are given a graph with N nodes and M directed edges. Find the number of Strongly connected compo...
Mother Vertex
Given a Directed Graph, find a Mother Vertex in the Graph (if present). A Mother Vertex is a verte...
Minimum Cost To Connect All Cities
There are n cities and there are roads in between some of the cities. Somehow all the roads are dama...
Number Of Enclaves
You are given an m * n binary matrix grid, where 0 represents a sea cell and 1 represents a land cel...
Zero One Matrix
Given an m*n binary matrix mat, return the distance of the nearest 0 for each cell. The distance...
Number Of Distinct Island
Given an m*n binary matrix mat, return the number of distinct island. An island is considered to...
Rotting Oranges
You are given an m * n matrix containing 0, 1 or 2 , where 0 represents an empty cell, 1 represents...
As Far From Land As Possible
Given an n*n grid containing only values 0 and 1, where 0 represents water and 1 represents land, fi...
Shortest Bridge
In a given 2D binary array grid, there are two islands. Now, we may change 0s to 1s so as to connect...
Articulation Point
A vertex in an undirected graph is an articluation point iff removing it disconnects the graph. You...
Sliding Puzzle
On an 2 x 3 board, there are five tiles labeled from 1 to 5, and an empty square represented by 0. A...
Bus Routes
You are given an array routes representing bus routes where routes[i] is a bus route that the ith bu...
Optimize Water Distribution
There are n construction sites in a town. We want to supply water for all the construction sites by...
Number Of Island 2
Given an m*n matrix mat, Originally, the 2D matrix is all 0 which means there is only sea in the mat...
Redundant Connection 2
You are given a directed graph that started as a tree with n nodes labeled from 1 to n, with one add...
Kruskal Algorithm
There are n vertices and there are edges in between some of the vertices. Find the sum of edge weig...
Critical Connection
An edge in an undirected graph is a Bridge iff removing it disconnects the graph. You have to print...
Satisfiability Of Equality Equation
You are given an array of strings equations that represent relationships between variables where eac...
Minimum Number Of Swaps Required To Sort An Array
Given an array of n distinct elements, find the minimum number of swaps required to sort the array.
Remove Max Number Of Edges To Keep Graph Fully Traversable
Alice and Bob have an undirected graph of n nodes and 3 types of edges: Type 1: Can be traversed...
Swim In Rising Water
https://leetcode.com/problems/swim-in-rising-water/
Coloring A Border
https://leetcode.com/problems/coloring-a-border/
Regions Cut By Slashes
https://leetcode.com/problems/regions-cut-by-slashes/
Reconstruct Itinerary
https://leetcode.com/problems/reconstruct-itinerary/
Rank Transform Of A Matrix
https://leetcode.com/problems/rank-transform-of-a-matrix/
Minimize Hamming Distance After Swap Operations
https://leetcode.com/problems/minimize-hamming-distance-after-swap-operations/
Accounts Merge
https://leetcode.com/problems/accounts-merge/
Number Of Provinces
https://leetcode.com/problems/number-of-provinces/
Minimize Malware Spread
https://leetcode.com/problems/minimize-malware-spread/
Minimize Malware Spread 2
https://leetcode.com/problems/minimize-malware-spread-ii/