输入:[5,7,2,3,10,10, 15,17,19,10,1,7,2,1]
输出:
result: {
greaterThanTen:[{startIndex:0, endIndex:3}],
lessThanTen:[
{startIndex:6, endIndex:8},
{startIndex:10, endIndex:13}]
}
说明:
const arrs = [11,12,13,10,1,2,3,10,14,15,16,10,7,8,9]
已知arrs
全是Number
类型元素,假设有一个基数为10,那么大于10的索引为0,1,2
,8,9,10
,小于10的索引为4,5,6
,12,13,14
, 最终区间段的想要的结果为:`{greaterThan:[{startIndex:0, endIndex:2},{startIndex:8, endIndex:10}],
lessThan:[{startIndex:4, endIndex:6},{startIndex:12, endIndex:14}]}`