Skip to content

Commit 5deb135

Browse files
author
Jaskaran Singh
authored
Create shuffle_string.js
1 parent 4887e0e commit 5deb135

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

shuffle_string.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @param {string} s
3+
* @param {number[]} indices
4+
* @return {string}
5+
*/
6+
var restoreString = function(s, indices) {
7+
let newStr = [];
8+
9+
indices.forEach((index, i) => {
10+
newStr[index] = s[i];
11+
});
12+
13+
return newStr.join("");
14+
};

0 commit comments

Comments
 (0)