▁images ▁to ▁detect ▁the ▁bright est ▁area ▁in ▁an ▁image . ▁ ▁K ad ane ' s ▁algorithm ▁ ▁K ad ane ' s ▁algorithm ▁sc ans ▁the ▁given ▁array ▁ ▁from ▁left ▁to ▁right . ▁ ▁In ▁the ▁th ▁step , ▁it ▁comput es ▁the ▁sub array ▁with ▁the ▁largest ▁sum ▁ending ▁at ▁; ▁this ▁sum ▁is ▁maintained ▁in ▁variable ▁current _ sum . ▁Moreover , ▁it ▁comput es ▁the ▁sub array ▁with ▁the ▁largest ▁sum ▁anywhere ▁in ▁, ▁maintained ▁in ▁variable ▁best _ sum , ▁and ▁easily ▁obtained ▁as ▁the ▁maximum ▁of ▁all ▁values ▁of ▁current _ sum ▁seen ▁so ▁far , ▁c f . ▁line ▁ 7 ▁of ▁the ▁algorithm . ▁ ▁As ▁a ▁loop ▁invariant , ▁in ▁the ▁th ▁step , ▁the ▁old ▁value ▁of ▁current _ sum ▁holds ▁the ▁maximum ▁over ▁all ▁ ▁of ▁the ▁sum ▁. ▁Therefore , ▁current _ sum ▁is ▁the ▁maximum ▁over ▁all ▁ ▁of ▁the ▁sum ▁. ▁To ▁extend ▁the ▁latter ▁maximum ▁to ▁cover ▁also ▁the ▁case ▁, ▁it ▁is ▁sufficient ▁to ▁consider ▁also ▁the ▁empty ▁sub array ▁. ▁This ▁is ▁done ▁in ▁line ▁ 6 ▁by ▁assigning ▁current _ sum ▁as ▁the ▁new ▁value ▁of ▁current _ sum , ▁which ▁after ▁that ▁holds ▁the ▁maximum ▁over ▁all ▁ ▁of ▁the ▁sum ▁. ▁ ▁Thus , ▁the ▁problem ▁can ▁be ▁solved ▁with ▁the ▁following ▁code , ▁expressed ▁here ▁in ▁Python : ▁ ▁def ▁max _ sub array ( numbers ): ▁▁▁▁ ▁""" Find ▁the ▁largest ▁sum ▁of ▁any ▁cont igu ous ▁sub array