在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
var arr1 = [1,3,4,6,7] var arr2 = [1,2,3,4,5,6,7,8,9] var result = [Int]() var index = 0 for a1 in arr1{ for a2 in arr2{ if a1 != a2{ //如果不重复就两个都要 result[index] = a1 index++ result[index] = a2 index++ }else{ //重复只要一个 result[index] = a1 index++ } } } for val in result{ print(val) }
|
请发表评论