← 返回 amazon 的题目列表Maximize Array Sequence After Bit Transformation Operations
类型:online_judge
amazon
You are tasked to create an array generator service for a testing team. Its input parameters are:
arr[] contains positive integers.
A is a string containing characters 0 or 1.
Each character can be chosen at most m times.
To create an integer array, perform exactly m operations to transform A[i] into an equal bit sequence, converting it into the desired integer order.
Given the initial input, determine the maximum possible sequence after m operations.
Input:
arr[]: An array of positive integers.
A: A string of 0 or 1.
m: An integer representing the number of operations.
Output: A sorted array.
Example:
arr[]: [1, 3, 5, 7] A = "101" m = 2 Returns: [1, 5, 5, 7]
Example
Input
{'arr': [1, 3, 5, 7], 'A': '101', 'm': 2}