//: Playground - noun: a place where people can play func makeReadLineMethod()->()->String? { var initStr:[String] = [ "4", "0 1 1 0" ] var idx = -1; func proc()->String? { idx+=1 return initStr[idx]; } return proc; } var readLine = makeReadLineMethod(); let pointCount = Int(readLine()!); let points = readLine()!.split(separator: " ").map({Int($0)!}).sorted(by: {$0<$1}); var ans = abs(points.first!-points.last!); for i in 1...points.count-1 { let tmp = points[i]-points[i-1]; if(tmp>0) { ans=min(ans, tmp); } } print(ans);