Home
Gaurav's GitHub Page
Cancel

Letter Combinations of a Phone Number

Problem Description Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order. A mapping of digi...

Word Search

Problem Description Given an m x n grid of characters board and a string word, return true if word exists in the grid. The word can be constructed from letters of sequentially adjacent cells, whe...

Binary Tree Paths

PROBLEM DESCRIPTION Given the root of a binary tree, return all root-to-leaf paths in any order. A leaf is a node with no children. Leetcode SOLUTION class Solution { public List<St...

Binary Tree Maximum Path Sum 2

PROBLEM DESCRIPTION A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence at most onc...

Count Good Nodes in Binary Tree

PROBLEM DESCRIPTION Given a binary tree root, a node X in the tree is named good if in the path from root to X there are no nodes with a value greater than X. Return the number of good nodes in t...

Subtree of Another Tree

PROBLEM DESCRIPTION Given the roots of two binary trees root and subRoot, return true if there is a subtree of root with the same structure and node values of subRoot and false otherwise. A subtr...

Balanced Binary Tree

PROBLEM DESCRIPTION Given a binary tree, determine if it is height-balanced. A height-balanced binary tree is a binary tree in which the depth of the two subtrees of every node never differs by mo...

Same Tree

PROBLEM DESCRIPTION Given the roots of two binary trees p and q, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally identical,...

Find the Duplicate Number

PROBLEM DESCRIPTION Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive. There is only one repeated number in nums, return this repeated ...

Remove Duplicates from Sorted List

PROBLEM DESCRIPTION Given the head of a sorted linked list, delete all duplicates such that each element appears only once. Return the linked list sorted as well. leetcode SOLUTION class Soluti...