Max processes ordered event values using reducer-style logic. Implement reduce_array to apply one selected operation from left to right, starting with an initial accumulator, and return the final result.
The operation must be applied as accumulator = operation(accumulator, current_value) for every element. Do not reorder the array, skip elements, or use Python's built-in reduce.
Implement reduce_array(values, initial, operation), where values is a list of numbers or strings, initial is the starting accumulator, and operation is one of "add", "multiply", "max", or "concat".
Return the final accumulator. For "add", "multiply", and "max", all values must be numbers. For "concat", all values and the initial accumulator must be strings. If values is empty, return initial unchanged.
def reduce_array(values, initial, operation):