摘要:
问题:给定一串由A~Z构成的字符串(允许重复)。 从中选取任意个字符,构成新的字符串,求可构成的字符串个数。 Example 1: Input: tiles = "AAB" Output: 8 Explanation: The possible sequences are "A", "B", "AA 阅读全文
摘要:
问题: 给定一组数,将其排列 使得相邻两个数的和,正好是一个可被平方的数。 求所有的排列可能个数。 Example 1: Input: [1,17,8] Output: 2 Explanation: [1,8,17] and [17,8,1] are the valid permutations. 阅读全文
摘要:
问题: 求位数为n,相邻数字之间绝对值为k的所有数的可能性。 Example 1: Input: n = 3, k = 7 Output: [181,292,707,818,929] Explanation: Note that 070 is not a valid number, because 阅读全文
摘要:
问题: 给定一个由字母和数字组成的字符串。 任意字母可以变换大小写,以组成新的字符串。 求给定字符串能够组成字符串的所有可能。 Example 1: Input: S = "a1b2" Output: ["a1b2","a1B2","A1b2","A1B2"] Example 2: Input: S 阅读全文
摘要:
问题: 给定1~N,N个数,对他们进行排列 对一个排列中的每个数: 若第i个数p[i]能被 i 整除,或者 i 能被第i个数p[i] 整除,那么成为最优排列。 请问这样的最优排列有多少个。 Example 1: Input: n = 2 Output: 2 Explanation: The firs 阅读全文