Home
Gaurav's GitHub Page
Cancel

Binary Tree Longest Consecutive Sequence

PROBLEM DESCRIPTION Given the root of a binary tree, return the length of the longest consecutive sequence path. A consecutive sequence path is a path where the values increase by one along the pa...

Find the Celebrity

PROBLEM DESCRIPTION Suppose you are at a party with n people labeled from 0 to n - 1 and among them, there may exist one celebrity. The definition of a celebrity is that all the other n - 1 people...

Find Permutation

PROBLEM DESCRIPTION A permutation perm of n integers of all the integers in the range [1, n] can be represented as a string s of length n - 1 where: s[i] == 'I' if perm[i] < perm[i + 1], an...

Missing Number In Arithmetic Progression

PROBLEM DESCRIPTION In some array arr, the values were in arithmetic progression: the values arr[i + 1] - arr[i] are all equal for every 0 <= i < arr.length - 1. A value from arr was removed...

First Unique Number

PROBLEM DESCRIPTION You have a queue of integers, you need to retrieve the first unique integer in the queue. Implement the FirstUnique class: FirstUnique(int[] nums) Initializes the object w...

Delete N Nodes After M Nodes of a Linked List

PROBLEM DESCRIPTION You are given the head of a linked list and two integers m and n. Traverse the linked list and remove some nodes in the following way: Start with the head as the current n...

Remove Interval

PROBLEM DESCRIPTION A set of real numbers can be represented as the union of several disjoint intervals, where each interval is in the form [a, b). A real number x is in the set if one of its inte...

Add Bold Tag in String

PROBLEM DESCRIPTION You are given a string s and an array of strings words. You should add a closed pair of bold tag <b> and </b> to wrap the substrings in s that exist in words. ...

Missing Ranges

PROBLEM DESCRIPTION You are given an inclusive range [lower, upper] and a sorted unique integer array nums, where all elements are within the inclusive range. A number x is considered missing if ...

Candy Crush

PROBLEM DESCRIPTION Given an m x n integer array board representing the grid of candy where board[i][j] represents the type of candy. A value of board[i][j] == 0 represents that the cell is empty....