Skip to content

Commit

Permalink
String repeat
Browse files Browse the repository at this point in the history
  • Loading branch information
PheRum committed Jun 15, 2024
1 parent 17b580a commit 20f7e96
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
10 changes: 10 additions & 0 deletions 8_kyu/String repeat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## String repeat

https://www.codewars.com/kata/57a0e5c372292dd76d000d7e

Write a function that accepts an integer n and a string s as parameters, and returns a string of s repeated exactly n times.

```js
6, "I" -> "IIIIII"
5, "Hello" -> "HelloHelloHelloHelloHello"
```
7 changes: 7 additions & 0 deletions 8_kyu/String repeat/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { repeatStr } from "./index";

describe("Tests", () => {
it("example", () => {
expect(repeatStr(3, "*")).toBe("***");
});
});
3 changes: 3 additions & 0 deletions 8_kyu/String repeat/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function repeatStr(n: number, s: string): string {
return s.repeat(n);
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

### Katas solved

`Total`: 99 \
`8_kyu`: 82 \
`Total`: 100 \
`8_kyu`: 83 \
`7_kyu`: 13 \
`6_kyu`: 4 \
`5_kyu`: 0 \
Expand Down
1 change: 0 additions & 1 deletion kata.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
8 kyu - String repeat - https://www.codewars.com/kata/57a0e5c372292dd76d000d7e
8 kyu - Remove exclamation marks - https://www.codewars.com/kata/57a0885cbb9944e24c00008e
8 kyu - Counting sheep... - https://www.codewars.com/kata/54edbc7200b811e956000556
8 kyu - Even or Odd - https://www.codewars.com/kata/53da3dbb4a5168369a0000fe
Expand Down

0 comments on commit 20f7e96

Please sign in to comment.