Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lcp/LCP 06. 拿硬币/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
```

<!-- tabs:end -->

<!-- solution:end -->
Expand Down
9 changes: 9 additions & 0 deletions lcp/LCP 06. 拿硬币/Solution.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class Solution {
func minCount(_ coins: [Int]) -> Int {
var ans = 0
for x in coins {
ans += (x + 1) >> 1
}
return ans
}
}
Loading