728x90
๋ฐ์ํ

Problem
Simple Array Sum | HackerRank
Calculate the sum of integers in an array.
www.hackerrank.com
Source Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let count = Int(readLine()!)! | |
let nums = String(readLine()!).split(separator: " ").map{Int($0)!} | |
func simpleArraySum(ar: [Int]) -> Int { | |
return ar.reduce(0){$0 + $1} | |
} | |
print(simpleArraySum(ar: nums)) |
728x90
๋ฐ์ํ
'๐ Problem Solution' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Swift] HackerRank Solve Me First (0) | 2022.01.31 |
---|---|
[Swift] Baekjoon ๋น๋ฐ๋ฒํธ ๋ฐ์ํ๊ธฐ 4569๋ฒ (0) | 2022.01.31 |
[Swift] Baekjoon ๋์ด์ ์ ๋ ฌ 10814๋ฒ (0) | 2022.01.30 |
[Swift] Baekjoon 12919๋ฒ A์ B 2 (0) | 2022.01.07 |
[Swift] Baekjoon ํฐ๋ฆฐ๋๋กฌ ๋ง๋ค๊ธฐ 1254๋ฒ (0) | 2022.01.06 |
๋๊ธ