Leetcode in Java && Oracle
421 subscribers
8 photos
397 files
400 links
Second channel: @codeforces_java

Let's Develop Together!
Download Telegram
image_2021-10-26_12-57-51.png
34.9 KB
#N1528. Shuffle String
problem link=>https://leetcode.com/problems/shuffle-string/

#solution
class Solution {
public String restoreString(String s, int[] indices) {
char[] ch=new char[s.length()];
for (int i = 0; i < s.length(); i++) {
ch[i] = s.charAt(i);
}
char[] newch=new char[ch.length];
for(int i=0; i<indices.length;i++){
newch[indices[i]]=ch[i];
}


return new String(newch);
}
}