So I am doing a school task that looks like this

[![enter image description here](https://i.stack.imgur.com/WpiMO.png)](https://i.stack.imgur.com/WpiMO.png)

and I have absolutely no idea where to even start. Could someone point me in the right direction? 

My idea of a starting point would be to calculate the discrepancy value of the root node first (the absolute value of the sum of the leaf values given) and then (somehow) check if there exists a discrepancy value higher than the root value, if not, the root value is the minimum possible discrepancy of the input. Am I on the right track? Currently I can't seem to get any further than this.

> 
> Important note: The tree that is built must "respect" the given order
>  of the values. For instance if the input is (5, 0, 0, -5) you are not
>  allowed to build your tree by first combining the first and the last
>  items into a tree. More formally: at every internal node, the input
>  values appearing as leaves in the left subtree of that node must all
>  come before the input values appearing as leaves in the right subtree.
> 
> 
> 

Thanks!