【发布时间】:2022-02-14 14:45:12
【问题描述】:
我有一个列表。
[
[4, 5, 6],
[5, 6, 7],
[8, 9, 10],
[20, 21, 22],
[22,23,24]
]
如果 [5,6,7] 的 upper_bound(5) 小于或等于 [4,5,6] 的 lower_bound(6) 则将它们合并在一起,最终列表应如下所示。
[
[
[4, 5, 6],
[5, 6, 7]
],
[8, 9, 10],
[
[20, 21, 22],
[22,23,24]
]
]
我该怎么做?
【问题讨论】:
-
我有点困惑。你把
upper_bound和lower_bound混在一起了吗? -
@AstridE。在列表
[6,7,8]中,不是upper_bound6 和lower_bound8 吗?还是我弄错了? -
上限应表示您的集合中的最大值(如“此集合中没有大于上限的值”);下限反之亦然。我不确定在此处引用哪个来源最准确,但例如Wolfram MathWorld 有定义。