Find Target Indices After Sorting Array
In this lab, you will be working with a 0-indexed integer array
nums and a target element
target. Your task is to find the target indices of
nums after sorting the array in non-decreasing order. A target index is an index
i such that
nums[i] == target. You need to return a list of the target indices, sorted in increasing order. If there are no target indices, return an empty list.
1nums = [1,2,5,2,3], target = 2 2Output: [1,2] 3Explanation: After sorting, nums is [1,2,2,3,5]. The indices where nums[i] == 2 are 1 and 2. 4 5nums = [1,2,5,2,3], target = 3 6Output:  7Explanation: After sorting, nums is [1,2,2,3,5]. The index where nums[i] == 3 is 3. 8 9nums = [1,2,5,2,3], target = 5 10Output:  11Explanation: After sorting, nums is [1,2,2,3,5]. The index where nums[i] == 5 is 4.
1 <= nums.length <= 100
1 <= nums[i], target <= 100
Keep the following points in mind while building the lab:
- Use ESM import/export everywhere.
- Check for all edge cases while building the lab and implement correct and precise evaluation scripts.
- Be very careful with the order of challenges written and their respective testing blocks in the evaluation script.
- You may use Puppeteer for running user's code, for example.
Once you have built the lab files, make sure to test the lab thoroughly using the evaluation scripts, checking for edge cases and correctness. And finally, submit your properly formatted lab in markdown and the respective lab files. Good luck!