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 ...
Distinct Subsequences
PROBLEM DESCRIPTION Given two strings s and t, return the number of distinct subsequences of s which equals t. leetcode SOLUTION class Solution { public int numDistinct(String s, String t)...
Longest Increasing Path in a Matrix
PROBLEM DESCRIPTION Given an m x n integers matrix, return the length of the longest increasing path in matrix. From each cell, you can either move in four directions: left, right, up, or down. Y...
Interleaving String
PROBLEM DESCRIPTION Given strings s1, s2, and s3, find whether s3 is formed by an interleaving of s1 and s2. An interleaving of two strings s and t is a configuration where s and t are divided in...
Target Sum
PROBLEM DESCRIPTION You are given an integer array nums and an integer target. You want to build an expression out of nums by adding one of the symbols ‘+’ and ‘-‘ before each integer in nums and ...
Coin Change II
PROBLEM DESCRIPTION You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. Return the number of combination...
Best Time to Buy and Sell Stock with Cooldown
PROBLEM DESCRIPTION You are given an array prices where prices[i] is the price of a given stock on the ith day. Find the maximum profit you can achieve. You may complete as many transactions as yo...
Word Break
PROBLEM DESCRIPTION Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words. Note that the same wor...
Palindrome Partitioning
Problem Description Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. leetcode Solution Start forming s...