Preview:
class Solution {
public:
    string restoreString(string s, vector<int>& indices) {
        int n=s.size();
        vector<char> S(n);
        for(int i=0;i<n;i++)
        {
            S[indices[i]]=s[i];
        }
        string s1="";
        for(int i=0;i<n;i++)
        {
           s1=s1+S[i] ;
        }
        return s1;
    }
};
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter