Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
371 views
in Technique[技术] by (71.8m points)

来道算法题,求最优解

var a = [1,3,4,11,32,45,222,98,111,333,231];
var b = [1,3,11,45,98]

求这个两个数组的位置连续部分的交集。
比如上面两个数组返回[1,3]


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

不好意思没看懂你的问题,连续指的是数值上的连续还是位置上的连续?交集是对哪个生成集合的交集?
是两个数组所有相同元素组成的集合,返回其中的数值连续的部分么?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...