-
Given a string containing only digits, restore it by returning all possible valid IP address combinations.
For example:Given...
-
Write a program to find the n-th ugly number.
Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For...
-
Given n, how many structurally unique BST’s (binary search trees) that store values 1…n?
For example,Given n = 3, there are a...
-
Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n.
F...
-
Given a 2D binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area.
For exampl...
-
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate nu...
-
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the ...
-
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique qua...
-
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
If such ...
-
Given a collection of numbers that might contain duplicates, return all possible unique permutations.
For example,[1,1,2] hav...