Home
Gaurav's GitHub Page
Cancel

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...

Letter Combinations of a Phone Number

Problem Description Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order. A mapping of digi...

Word Search

Problem Description Given an m x n grid of characters board and a string word, return true if word exists in the grid. The word can be constructed from letters of sequentially adjacent cells, whe...