Ans :
import Foundation
let arr = [1,2,4,5,8,6,9,7]
let n = arr.count
let total = ((n + 1)*(n + 2))/2
var missingNum = total
for item in arr {
missingNum = missingNum - item
}
print(missingNum)
No comments:
Post a Comment
Thanks