LeetCode Decode Ways II A message containing letters from A-Z is being encoded to numbers using the following mapping way: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Beyond that, now the encoded string can also contain the character '*', which can... Read More

# Tag Archives: 排列

# LeetCode Find the Derangement of An Array

LeetCode Find the Derangement of An Array In combinatorial mathematics, a derangement is a permutation of the elements of a set, such that no element appears in its original position. There's originally an array consisting of n integers from 1... Read More

# LeetCode Valid Triangle Number

LeetCode Valid Triangle Number Given an array consists of non-negative integers, your task is to count the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle. Example 1: Input: Output:... Read More

# LeetCode Number of Boomerangs

LeetCode Number of Boomerangs Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between iand j equals the distance between i and k (the order of the tuple matters). Find the... Read More

# LeetCode Subsets II

LeetCode Subsets II Given a collection of integers that might contain duplicates, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. For example, If nums = , a solution is: , , , , , ... Read More

# LeetCode Permutation Sequence

LeetCode Permutation Sequence The set contains a total of n! unique permutations. By listing and labeling all of the permutations in order, We get the following sequence (ie, for n = 3): "123" "132" "213" "231" "312" "321" Given n and k, return the... Read More

# LeetCode Next Permutation

LeetCode Next Permutation Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in... Read More

# LeetCode Permutations II

LeetCode Permutations II Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example, have the following unique permutations: , , ... Read More

# LeetCode Permutations

LeetCode Permutations Given a collection of distinct numbers, return all possible permutations. For example, have the following permutations: , , , , , ... Read More