Skip to content

Commit d7c72d6

Browse files
committed
feat: add solutions to lcp problem: No.06
1 parent 1ea57a8 commit d7c72d6

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

lcp/LCP 06. 拿硬币/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,18 @@ int minCount(int* coins, int coinsSize) {
104104
}
105105
```
106106
107+
### **TypeScript**
108+
109+
```ts
110+
function minCount(coins: number[]): number {
111+
let ans = 0;
112+
for (const coin of coins) {
113+
ans += Math.floor((coin + 1) / 2);
114+
}
115+
return ans;
116+
}
117+
```
118+
107119
### **...**
108120

109121
```

lcp/LCP 06. 拿硬币/Solution.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function minCount(coins: number[]): number {
2+
let ans = 0;
3+
for (const coin of coins) {
4+
ans += Math.floor((coin + 1) / 2);
5+
}
6+
return ans;
7+
}

0 commit comments

Comments
 (0)