diff --git "a/lcp/LCP 06. \346\213\277\347\241\254\345\270\201/README.md" "b/lcp/LCP 06. \346\213\277\347\241\254\345\270\201/README.md" index a13eeebc8f399..fd1f297a5456f 100644 --- "a/lcp/LCP 06. \346\213\277\347\241\254\345\270\201/README.md" +++ "b/lcp/LCP 06. \346\213\277\347\241\254\345\270\201/README.md" @@ -154,6 +154,20 @@ int minCount(int* coins, int coinsSize) { } ``` +#### Swift + +```swift +class Solution { + func minCount(_ coins: [Int]) -> Int { + var ans = 0 + for x in coins { + ans += (x + 1) >> 1 + } + return ans + } +} +``` + diff --git "a/lcp/LCP 06. \346\213\277\347\241\254\345\270\201/Solution.swift" "b/lcp/LCP 06. \346\213\277\347\241\254\345\270\201/Solution.swift" new file mode 100644 index 0000000000000..9b88a97b003b4 --- /dev/null +++ "b/lcp/LCP 06. \346\213\277\347\241\254\345\270\201/Solution.swift" @@ -0,0 +1,9 @@ +class Solution { + func minCount(_ coins: [Int]) -> Int { + var ans = 0 + for x in coins { + ans += (x + 1) >> 1 + } + return ans + } +} \ No newline at end of file