NOKIA - Editorial

can someone explain in brief , how to come up with this formula,
" minLen[n] = (n+1) + minLen[n/2] + minLen[n-1-n/2] " ?

Better to write ‘lg(n+1)’ (‘log’ base 2).

I made my solution according to the editorial , someone please have look on code and suggest the mistakes?
I matched few test cases with the solution all good , but its always WA while submitting.

Here’s my


[1] 

Thankyou
  [1]: https://ideone.com/cCKp2G

i got the perfect explanation of the logic used by setter, but i am not allowed to post image here. so if anyone is curious to know, can mail me @ [email protected]

how can we say that any value between max an d min is possible?
anyone with a concrete proof for it?