Home
Gaurav's GitHub Page
Cancel

Valid Parenthesis String

PROBLEM DESCRIPTION Given a string s containing only three types of characters: ‘(‘, ‘)’ and ‘*’, return true if s is valid. The following rules define a valid string: Any left parenthesis ‘(...

Partition Labels

PROBLEM DESCRIPTION You are given a string s. We want to partition the string into as many parts as possible so that each letter appears in at most one part. Note that the partition is done so tha...

Merge Triplets to Form Target Triplet

PROBLEM DESCRIPTION A triplet is an array of three integers. You are given a 2D integer array triplets, where triplets[i] = [ai, bi, ci] describes the ith triplet. You are also given an integer ar...

Hand of Straights

PROBLEM DESCRIPTION Alice has some number of cards and she wants to rearrange the cards into groups so that each group is of size groupSize, and consists of groupSize consecutive cards. Given an ...

Gas Station

PROBLEM DESCRIPTION There are n gas stations along a circular route, where the amount of gas at the ith station is gas[i]. You have a car with an unlimited gas tank and it costs cost[i] of gas to...

Jump Game II

PROBLEM DESCRIPTION You are given a 0-indexed array of integers nums of length n. You are initially positioned at nums[0]. Each element nums[i] represents the maximum length of a forward jump fro...

Jump Game

PROBLEM DESCRIPTION You are given an integer array nums. You are initially positioned at the array’s first index, and each element in the array represents your maximum jump length at that position...

Maximum Subarray

PROBLEM DESCRIPTION Given an integer array nums, find the subarray with the largest sum, and return its sum. leetcode SOLUTION class Solution { public int maxSubArray(int[] nums) { ...

Burst Balloons

PROBLEM DESCRIPTION You are given n balloons, indexed from 0 to n - 1. Each balloon is painted with a number on it represented by an array nums. You are asked to burst all the balloons. If you bu...

Regular Expression Matching

PROBLEM DESCRIPTION Given an input string s and a pattern p, implement regular expression matching with support for ‘.’ and ‘*’ where: ’.’ Matches any single character.​​​​ ‘*’ Matches zero ...