Skip to content

Commit e894ebd

Browse files
committed
https://leetcode.cn/problems/shuffle-string/
1 parent d5ed92d commit e894ebd

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ leetcode 测试
1010

1111
##### 包含的内容如下
1212

13+
https://leetcode.cn/problems/shuffle-string/
14+
1315
https://leetcode.cn/problems/make-the-string-great/
1416

1517
https://leetcode.cn/problems/replace-all-s-to-avoid-consecutive-repeating-characters/

shuffle-string/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default function restoreString(s: string, indices: number[]): string {
2+
//@ts-ignore
3+
return Array.prototype.reduce.call(s, (p, c, i) => (p[indices[i]] = c, p), [
4+
...s,
5+
]).join("");
6+
}

0 commit comments

Comments
 (0)