public class Solution { public string RestoreString(string s, int[] indices) { var sb = new StringBuilder(); for (var i = 0; i < indices.Length; ++i) { var charPosition = Array.IndexOf(indices, i); sb.Append(s[charPosition]); } return sb.ToString(); } }Source: https://leetcode.com/problems/shuffle-string/
No comments:
Post a Comment