Leetcode Problem 1528. Shuffle String

1528. Shuffle String

Leetcode Solutions

Shuffle String Using Index Mapping

  1. Initialize a new string or character array result of the same length as s.
  2. Iterate over the length of s using a loop variable i.
  3. For each i, place the character s[i] at the index indices[i] in the result.
  4. After the loop, if result is a character array, convert it to a string.
  5. Return the result string.
UML Thumbnail

Shuffle String Using Sorting

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...