PROBLEM DESCRIPTION You are given an array of non-overlapping intervals intervals where intervals[i] = [starti, endi] represent the start and the end of the ith interval and intervals is sorted in...
Merge Intervals
PROBLEM DESCRIPTION Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the interv...
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) { ...