Home
Gaurav's GitHub Page
Cancel

Swim in Rising Water

Problem Description You are given an n x n integer matrix grid where each value grid[i][j] represents the elevation at that point (i, j). The rain starts to fall. At time t, the depth of the wate...

Reconstruct Itinerary

Problem Description You are given a list of airline tickets where tickets[i] = [fromi, toi] represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order and r...

Cheapest Flights Within K Stops

Problem Description There are n cities connected by some number of flights. You are given an array flights where flights[i] = [fromi, toi, pricei] indicates that there is a flight from city fromi ...

Network Delay Time

Problem Description You are given a network of n nodes, labeled from 1 to n. You are also given times, a list of travel times as directed edges times[i] = (ui, vi, wi), where ui is the source node...

Min Cost to Connect All Points

Problem Description You are given an array points representing integer coordinates of some points on a 2D-plane, where points[i] = [xi, yi]. The cost of connecting two points [xi, ...

Word Ladder

Problem Description A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> … -> sk such that: Eve...

Walls and Gates

Problem Description You are given an m x n grid rooms initialized with these three possible values. -1 A wall or an obstacle. 0 A gate. INF Infinity means an empty room. We use the value 2...

Pacific Atlantic Water Flow

Problem Description There is an m x n rectangular island that borders both the Pacific Ocean and Atlantic Ocean. The Pacific Ocean touches the island’s left and top edges, and the Atlantic Ocean t...

Distance from the Source (Bellman-Ford Algorithm)

Problem Description Given a weighted, directed and connected graph of V vertices and E edges, Find the shortest distance of all the vertex’s from the source vertex S. Note: If the Graph contains a...

Floyd Warshall

Problem Description The problem is to find the shortest distances between every pair of vertices in a given edge-weighted directed graph. The graph is represented as an adjacency matrix of size n*...