SP16809 EST - Estimation
Description
“There are too many numbers here!” your boss bellows. “How am I supposed to make sense of all of this? Pare it down! Estimate!” You are disappointed. It took a lot of work to generate those numbers. But, you’ll do what your boss asks. You decide to estimate in the following way: You have an array A of numbers. You will partition it into k contiguous sections, which won’t necessarily be of the same size. Then, you’ll use a single number to estimate an entire section. In other words, for your array A of size n, you want to create another array B of size n, which has k contiguous sections. If i and j are in the same section, then B\[i\]=B\[j\]. You want to minimize the error, expressed as the sum of the absolute values of the differences (∑|A\[i\]-B\[i\]|).
Input Format
N/A
Output Format
N/A