All tags

Lattice Paths

Count the number of unique paths to travel from the top left corner to the bottom right corner of a lattice of M x N squares.

Find the Duplicate Number

Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist.

Find Minimum in Rotated Sorted Array

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.

Longest Increasing Subsequence

Given an unsorted array of integers, find the length of longest increasing subsequence.

Longest Common Subsequence

Given two strings text1 and text2, return the length of their longest common subsequence.

Combination Sum

Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target.

The same repeated number may be chosen from candidates unlimited number of times.

Unique Paths

A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).

Coin Change

You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1.

Coin Sum

You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1.

Partition to K Equal Sum Subsets

Given an array of integers nums and a positive integer k, find whether it's possible to divide this array into k non-empty subsets whose sums are all equal.

Prison Cells After N Days

There are 8 prison cells in a row, and each cell is either occupied or vacant.

Sort Colors

Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white and blue.