Home  >  Article  >  php教程  >  由正负数组成的任意长度数组,求任意长度最大和值?

由正负数组成的任意长度数组,求任意长度最大和值?

PHP中文网
PHP中文网Original
2016-05-25 16:59:261193browse

如数组:array(1,-3,-5,-7,8,9,-11,5);
最大长度为:8,9;
和值为17.

<?php
function get_max_sum(){
//TODO @大神请做!
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn