-- http://www.codewars.com/kata/54521e9ec8e60bc4de000d6c
module MaxSequence where

maxSequence :: [Int] -> Int
maxSequence [] = 0
maxSequence [x] = 0 `max` x
maxSequence xs = maxSequence ys `max` (maxStartSeq (reverse ys) + maxStartSeq zs) `max` maxSequence zs where
  (ys, zs) = splitAt (length xs `div` 2) xs
  maxStartSeq ts = maximum $ scanl (+) 0 ts

