[swift] 61. Set Union

RudinP·2023년 10월 26일
0

Study

목록 보기
88/227

Set Union

  • 중복을 제거하고 set을 병합
let friendGroupA = ["철수", "영희", "멍멍", "야옹"]
let friendGroupB = ["철수", "영희", "짹짹", "우엉"]

let friendGroupASet = Set(friendGroupA)
let friendGroupBSet = Set(friendGroupB)

let totalFriend = friendGroupASet.union(friendGroupBSet)
//["철수", "영희", "멍멍", "야옹", "짹짹", "우엉"]
profile
곰을 좋아합니다. <a href = "https://github.com/RudinP">github</a>

0개의 댓글