介绍
在一次私人聊天中,我的一个朋友显然是最近偶然发现了一个安全系统,该系统的有效密码有以下两个限制:
- 每个数字必须唯一(即“ 1”只能出现一次)
- 数字的顺序无关紧要(“ 1234” =“ 4321”)
因此,为了说明该挂锁系统的严重程度,让我们实际枚举所有有效的PIN!
输入值
您的输入将包含一个正整数,表示PIN的长度。
输出量
您的输出包含一个非负整数或字符串*的列表,这些列表会枚举给定长度的所有有效PIN。
*更精确地说,如果您要为它们打印,则人类可以尝试使用所有组合。这意味着一组数字集和一组数字数组都可以。
谁赢?
这是代码高尔夫球,因此最短的答案以字节为单位!适用标准规则和漏洞。
角落案例
- 如果输入大于10的整数,则输出行为不确定。
- 每个输出条目中数字的顺序是不确定的,因为带有零的条目实际上包含所说的零,也就是说,您可能不会去除“ 0123”到“ 123”,但是“ 1230”,“ 1203”和“ 1023”都是有效的就像“ 0123”一样。
测试用例
1
[0,1,2,3,4,5,6,7,8,9]
2
[10,20,30,40,50,60,70,80,90,21,31,41,51,61,71,81,91,32,42,52,62,72,82,92,43,53,63,73,83,93,54,64,74,84,94,65,75,85,95,76,86,96,87,97,98]
3
[210,310,410,510,610,710,810,910,320,420,520,620,720,820,920,430,530,630,730,830,930,540,640,740,840,940,650,750,850,950,760,860,960,870,970,980,321,421,521,621,721,821,921,431,531,631,731,831,931,541,641,741,841,941,651,751,851,951,761,861,961,871,971,981,432,532,632,732,832,932,542,642,742,842,942,652,752,852,952,762,862,962,872,972,982,543,643,743,843,943,653,753,853,953,763,863,963,873,973,983,654,754,854,954,764,864,964,874,974,984,765,865,965,875,975,985,876,976,986,987]
4
[3210,4210,5210,6210,7210,8210,9210,4310,5310,6310,7310,8310,9310,5410,6410,7410,8410,9410,6510,7510,8510,9510,7610,8610,9610,8710,9710,9810,4320,5320,6320,7320,8320,9320,5420,6420,7420,8420,9420,6520,7520,8520,9520,7620,8620,9620,8720,9720,9820,5430,6430,7430,8430,9430,6530,7530,8530,9530,7630,8630,9630,8730,9730,9830,6540,7540,8540,9540,7640,8640,9640,8740,9740,9840,7650,8650,9650,8750,9750,9850,8760,9760,9860,9870,4321,5321,6321,7321,8321,9321,5421,6421,7421,8421,9421,6521,7521,8521,9521,7621,8621,9621,8721,9721,9821,5431,6431,7431,8431,9431,6531,7531,8531,9531,7631,8631,9631,8731,9731,9831,6541,7541,8541,9541,7641,8641,9641,8741,9741,9841,7651,8651,9651,8751,9751,9851,8761,9761,9861,9871,5432,6432,7432,8432,9432,6532,7532,8532,9532,7632,8632,9632,8732,9732,9832,6542,7542,8542,9542,7642,8642,9642,8742,9742,9842,7652,8652,9652,8752,9752,9852,8762,9762,9862,9872,6543,7543,8543,9543,7643,8643,9643,8743,9743,9843,7653,8653,9653,8753,9753,9853,8763,9763,9863,9873,7654,8654,9654,8754,9754,9854,8764,9764,9864,9874,8765,9765,9865,9875,9876]