Home
Gaurav's GitHub Page
Cancel

Find Players With Zero or One Losses

Problem Description You are given an integer array matches where matches[i] = [winneri, loseri] indicates that the player winneri defeated player loseri in a match. Return a list answer of size 2...

Redundant Connection

Problem Description In this problem, a tree is an undirected graph that is connected and has no cycles. You are given a graph that started as a tree with n nodes labeled from 1 to n, with one add...

Course Schedule II

Problem Description There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates tha...

Course Schedule

Problem Description There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates tha...

Surrounded Regions

Problem Description Given an m x n matrix board containing ‘X’ and ‘O’, capture all regions that are 4-directionally surrounded by ‘X’. A region is captured by flipping all ‘O’s into ‘X’s in that...

Max Area of Island

Problem Description You are given an m x n binary matrix grid. An island is a group of 1’s (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of ...

Rotten Oranges

Problem Description You are given an m x n grid where each cell can have one of three values: 0 representing an empty cell, 1 representing a fresh orange, or 2 representing a rotten orange...

Number of Islands

Problem Description Given an m x n 2D binary grid grid which represents a map of ‘1’s (land) and ‘0’s (water), return the number of islands. An island is surrounded by water and is formed by conn...

Number of Connected Components in an Undirected Graph

Problem Description You have a graph of n nodes. You are given an integer n and an array edges where edges[i] = [ai, bi] indicates that there is an edge between ai and bi in the graph. Return the...

Depth First Search

Problem Description You are given a connected undirected graph. Perform a Depth First Traversal of the graph. Note: Use a recursive approach to find the DFS traversal of the graph starting from th...