我在对Seq [Seq [Int]]

In scala,I am trying to sort the below sequence of sequence,Seq(Seq(2,3,4),Seq(1),Seq(1,2),2,3),Seq(2,4,5),Seq(3,6),5))
.sortWith((a,b)=>{
  (a zip b).filterNot(x => (x._1==x._2 || x._1 &gt x._2)).size > b.size
})

Output required:

  <br/>1
  <br/>1,2
  <br/>1,3
  <br/>1,4
  <br/>2,3
  <br/>2,5
  <br/>2,5
  <br/>3,4
  <br/>3,6


The pattern that I am looking for is similar to the following,<br/>1
  <br/>1,5,6,7
  <br/>3
  <br/>3,5
此模式类似于三角形,但应以相同的数字开头,然后再次是另一个三角形,该三角形应在上一个起始数字旁边开始。

直接比较2个序列,但这很具有挑战性。

请帮助我解决该情况。

niuliang1023 回答:我在对Seq [Seq [Int]]

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3141182.html

大家都在问