Question: Question 1: Write a Python program Given a string s and an integer array indicesof the same length. The string s will be shuffled such
Question 1: Write a Python program
Given a string s and an integer array indicesof the same length.
The string s will be shuffled such that the character at the ithposition moves to indices[i] in the shuffled string. Return theshuffled string.
Sample Output:
Input: s = "codeleet", indices = [4,5,6,7,0,2,1,3]
Output: "leetcode"
Explanation: As shown, "codeleet" becomes "leetcode" aftershuffling.
or:
Input : string = “nuectyr”, indices = [2,4,1,0,3,6,5]
Output: century
Explanation: As shown, "nuectyr" becomes "century" aftershuffling.
Step by Step Solution
3.37 Rating (153 Votes )
There are 3 Steps involved in it
Here is the code for the above question Given string s list codeleet Given Indices indices 45670213 ... View full answer
Get step-by-step solutions from verified subject matter experts
