Data Structures & AlgorithmsHard
You are given an array of servers represented by their processing power. You want to join consecutive servers together to form larger, more powerful servers. You can only join server i with server i+1 if the processing power of server i+1 is strictly greater than the processing power of server i. This joining process can cascade, meaning that if you join i and i+1, and the new combined processing power is less than i+2, you can then join the combined server with i+2, and so on. The goal is to maximize the number of these larger servers. For example: Consider the array [1, 2, 3, 4, 5]. You can join 1 and 2 to form 3. Then you can join 3 and 3 to form 6. Then you can join 6 and 4 to form 10. Finally, you can join 10 and 5 to form 15, resulting in one server with processing power 15. Consider the array [5, 4, 3, 2, 1]. You cannot join any servers because the processing power is always decreasing. Consider the array [1, 3, 2, 4, 1, 5]. You can join 1 and 3 to get 4. You cannot join 4 and 2. You can join 2 and 4 to get 6. You cannot join 6 and 1. You can join 1 and 5 to get 6. The final servers will be [4, 6, 6]. Write a function that takes an array of integers representing server processing powers and returns the final array of server processing powers after performing all possible joins.