DI String Match Lab

Easy
2
11.8% Acceptance

In this lab, you will be working with a permutation perm of n + 1 integers of all the integers in the range [0, n] and a related string s of length n. The relationship between perm and s is as follows:

  • s[i] == 'I' if perm[i] < perm[i + 1], and
  • s[i] == 'D' if perm[i] > perm[i + 1].

Your task is to reconstruct the permutation perm from the given string s and return it. If there are multiple valid permutations perm, return any of them.

In this lab, you will be provided with a partially working code. You have to create challenges based on the given code and evaluation script. You will also need to ensure that the evaluation script is working correctly for the challenges you create.

Here is a detailed example to help you understand the problem:

Example 1:

Input: s = "IDID" Output: [0,4,1,3,2]

Example 2:

Input: s = "III" Output: [0,1,2,3]

Example 3:

Input: s = "DDI" Output: [3,2,0,1]

Lab Challenges

You have to create challenges for this lab based on the given problem statement. Make sure to provide proper instructions and explanations for each challenge.

Challenge 1

Write a concise challenge description explaining the task.

Challenge 2

Write a concise challenge description explaining the task.