Update max.subsum.cpp

add an O(n) method