Maximum Subarray Sum

  • + 0 comments

    That's because you take a difference. Say m=7, then you could have e.g. prefix values 2 and 5 (both are already % m). The difference is -3. You add 7 to get 4, which is the actual modulo you need.