The expression return array_sum($ans) could return the type double which is incompatible with the type-hinted return integer. Consider adding an additional type-check to rule them out.
Loading history...
55
}
56
57
public static function maxProfit4(array $prices): int