We are given a sequence of numbers. We have to divide that sequence into $ k $ contigous sequence. And let sum of $i $ th patition would be $S_i$. Then we have to divide the sequence such that value of $T = S_1^2 + S_2^2 + \cdots + S_k^2 $ is minimum. Then how can we find minimum vaue of $T$ .
I thought of sorting the array the divide into $k $ parts.
Am I correct?
Can anybody please help me in this?
Using Cauchy-Schwarz inequality: $T \ge \dfrac{(S_1+S_2+...+S_k)^2}{k} = \dfrac{(a_1+a_2+...+a_n)^2}{k}= T_{\text{min}}$