Company: Apple_3sep
Difficulty: medium
Maximum Profit from Chain Cutting Problem Description You're a jeweller working with a chain of precious metal of a specific length. The total length of the chain is determined by the length of the input array. Each segment of the chain, based on its length, has a specific value. You are given a list of values where arr[i] is the value of a chain segment of length i+1 . To maximize the profit, you can decide to cut the chain into smaller pieces and sell each segment individually at its respective value. Your task is to determine the highest value you can obtain by choosing an optimal way to cut (or not cut) the chain. Note: Index 0 indicates a length of 1 and so on. Examples Example 1: Input: arr = [3, 5, 8, 9, 10, 17, 17, 20] Output: 24 Explanation: The total length of the chain is 8 (the size of the array). The maximum obtainable value is 24 by cutting the chain into 8 pieces of length 1. The price for a piece of length 1 is arr[0] = 3 . Therefore, the total profit is 8 * 3 = 24. Con