위 풀이를 고차함수 map을 이용해서 풀어보았다! compactMap은 시퀀스 각 요소를 조건을 지정하여 호출할 때, nil이 아닌 결과를 포함하여 리턴한다. 즉, compactMap은 nil 값도 알아서 걸러주고, 옵셔널 값도 벗겨주는 함수이다. (자세한 내용과 예시는 아래 swift docu 확인! ) compactMap(_:) | Apple Developer Documentation Returns an array containing the non- results of calling the given transformation with each element of this sequence. developer.apple.com while문 활용 num이 0보다 큰 경우 while문 반복 arr에 num..