for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Lesson07;
class MaxSliceSum
{
public function solution($A)
$N = count($A);
$maxSum = $A[0];
$maxSumAfter = $A[0];
for ($i = 1; $i < $N; $i++) {
$maxSumAfter = max($A[$i], $maxSumAfter + $A[$i]);
$maxSum = max($maxSum, $maxSumAfter);
}
return $maxSum;