84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
比如:1 4 2 5 9 中寻找大于6的组合
1 2 4 1 2 5 1 2 9 1 4 5 1 4 9 2 4 5 2 4 9 4 5 9
一共8个组合。
如果是自然数序列,可以先排序再找到最小的满足组合,接下来只需要复杂度为n的算法就可以得到结果。但是如果序列的值是离散的,使时间复杂度尽可能小的算法应该怎么考虑呢?
备注: 数值大于10^16
认证高级PHP讲师
Are there any problems with using the algorithm you mentioned for energy addition and comparison?
Can’t we sort natural numbers? If the value is larger, you can also sort it, and the complexity is only related to the number of numbers you have
Are there any problems with using the algorithm you mentioned for energy addition and comparison?
Can’t we sort natural numbers? If the value is larger, you can also sort it, and the complexity is only related to the number of numbers you have