Company: Amazon_4april
Difficulty: medium
Your project team needs to work closely with a group of software testers. They have requested that your team create an array generator service to assist with testing software functionality. Create an array generator service. Its input parameters are: values[n] contains n positive integers. state is a string that contains n characters. Each character is a '0' or '1'. If state[i] = '1' , values[i] is available. If state[i] = '0' , values[i] is blocked. To create an integer array, S , the following operation is performed exactly m times. S is initially empty. Choose any values[i] that is available, that is, where state[i] = '1' ; the same element can be chosen any number of times. Append the value in values[i] to S . For all state[i] = '0' such that state[i-1] = '1' , change state[i] to '1'. For example, if state = '0100101' before the operation, it equals '0110111' after the operation. Find the lexicographically largest sequence S that can be obtained after m operations. Note: A sequence