▁ ▁and ▁ ▁with ▁, ▁such ▁that ▁the ▁sum ▁▁ ▁is ▁as ▁large ▁as ▁possible . ▁( Some ▁form ulations ▁of ▁the ▁problem ▁also ▁allow ▁the ▁empty ▁sub array ▁to ▁be ▁considered ; ▁by ▁convention , ▁the ▁sum ▁of ▁all ▁values ▁of ▁the ▁empty ▁sub array ▁is ▁zero .) ▁ ▁Each ▁number ▁in ▁the ▁input ▁array ▁A ▁could ▁be ▁positive , ▁negative , ▁or ▁zero . ▁ ▁For ▁example , ▁for ▁the ▁array ▁of ▁values ▁[ − 2 , ▁ 1 , ▁− 3 , ▁ 4 , ▁− 1 , ▁ 2 , ▁ 1 , ▁− 5 , ▁ 4 ], ▁the ▁cont igu ous ▁sub array ▁with ▁the ▁largest ▁sum ▁is ▁[ 4 , ▁− 1 , ▁ 2 , ▁ 1 ], ▁with ▁sum ▁ 6 . ▁ ▁Some ▁properties ▁of ▁this ▁problem ▁are : ▁▁ ▁If ▁the ▁array ▁contains ▁all ▁non - negative ▁numbers , ▁then ▁the ▁problem ▁is ▁trivial ; ▁a ▁maximum ▁sub array ▁is ▁the ▁entire ▁array . ▁ ▁If ▁the ▁array ▁contains ▁all ▁non - pos itive ▁numbers , ▁then ▁a ▁solution ▁is ▁any ▁sub array ▁of ▁size ▁ 1 ▁containing ▁the ▁maximal ▁value ▁of ▁the ▁array ▁( or ▁the ▁empty ▁sub array , ▁if ▁it ▁is ▁permitted ). ▁ ▁Several ▁different ▁sub - array s ▁may ▁have ▁the ▁same ▁maximum ▁sum . ▁ ▁This ▁problem ▁can ▁be ▁solved ▁using ▁several ▁different ▁algorithm ic ▁techniques , ▁including ▁br ute ▁force , ▁divide ▁and ▁conquer , ▁dynamic ▁programming , ▁and ▁reduction ▁to ▁short est ▁paths .