Shuffle String Problem

Shuffle String Problem — ExecCode Easy DSA Practice

Solve the Shuffle String problem on ExecCode. Free online easy DSA practice in Arrays - Logic Building. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given a string s and an integer array indices of the same length. Your task is to compute the required answer and return the shuffled string. The string s will be shuffled such that the character at the i^th position moves to indices[i] in the shuffled string.

Examples

Input {"s": "codeleet", "indices": [4, 5, 6, 7, 0, 2, 1, 3]}; Output leetcode. Input {"s": "abc", "indices": [0, 1, 2]}; Output abc

Constraints

s.length == indices.length == n 1 <= n <= 100 s consists of only lowercase English letters. 0 <= indices[i] < n All values of indices are unique.

Practice Shuffle String free on ExecCode. Browse DSA problems, topic map, and placement guides.