feat: add swift implementation to lcp problem: No.06 (#3741)

This commit is contained in:
Lanre Adedara 2024-11-11 09:41:57 +01:00 committed by GitHub
parent 430ebdc191
commit 83f3c4ede8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 0 deletions

View File

@ -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 -->

View File

@ -0,0 +1,9 @@
class Solution {
func minCount(_ coins: [Int]) -> Int {
var ans = 0
for x in coins {
ans += (x + 1) >> 1
}
return ans
}
}