Home
Gaurav's GitHub Page
Cancel

Populating Next Right Pointers in Each Node II

PROBLEM DESCRIPTION Given a binary tree struct Node { int val; Node *left; Node *right; Node *next; } Populate each next pointer to point to its next right node. If there is no next rig...

Partition List

PROBLEM DESCRIPTION Given the head of a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relat...

Add Binary

PROBLEM DESCRIPTION Given two binary strings a and b, return their sum as a binary string. leetcode SOLUTION class Solution { public String addBinary(String a, String b) { // ...

Remove Duplicates from Sorted List II

PROBLEM DESCRIPTION Given the head of a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. Return the linked list sorted as wel...

Reverse Linked List II

PROBLEM DESCRIPTION Given the head of a singly linked list and two integers left and right where left <= right, reverse the nodes of the list from position left to position right, and return th...

Basic Calculator

PROBLEM DESCRIPTION Given a string s representing a valid expression, implement a basic calculator to evaluate it, and return the result of the evaluation. Note: You are not allowed to use any bui...

Simplify Path

PROBLEM DESCRIPTION Given a string path, which is an absolute path (starting with a slash ‘/’) to a file or directory in a Unix-style file system, convert it to the simplified canonical path. In ...

Valid Parentheses

PROBLEM DESCRIPTION Given a string s containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid. An input string is valid if: Open brackets must be...

Minimum Number of Arrows to Burst Balloons

PROBLEM DESCRIPTION There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array points where points[i] = [xstart, xend...

Summary Ranges

PROBLEM DESCRIPTION You are given a sorted unique integer array nums. A range [a,b] is the set of all integers from a to b (inclusive). Return the smallest sorted list of ranges that cover all t...