Back to problems

Array Generation Service

Algorithm · Amazon · Hard

Array Generator Service You are designing a utility that creates an integer sequence S for testing. The utility takes an array arr containing n positive integers and a binary string state of length n. A value arr[i] is considered enabled when state[i] == '1'; if state[i] == '0', that value is disabled. Perform this process exactly m times: Pick any enabled value arr[i] and add it to the end of S. The same index may be picked more than once. After the pick, update the…

Checking your access…