Category: dynamic programming
Given N natural integers (from 1 to N), the number of all permutations is N! (Factorial). That is explained by the fact: There are N choices when selecting the …
Given a non-negative integer n, please find out the number of integers that have the unique digits between [0, 10^n). For example, if n = 2, there are 91 …
There is a 2D binary matrix M filled with 0’s and 1’s, your task is to find the largest square containing all 1’s and return its area. For example, …
This is an interesting problem that can be solved using Dynamic Programming (DP). The question is to count how many ways to connect the pipes like the following (Pipes …
Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array , the contiguous subarray has the largest …