{"size": 618, "ext": "js", "max_stars_repo_path": "JS/Practice-JS/Practice-JS/Problem1 - MaxSum/scripts.js", "max_stars_repo_name": "kaizer04/Telerik-Academy-2013-2014", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "JS/Practice-JS/Practice-JS/Problem1 - MaxSum/scripts.js", "max_issues_repo_name": "kaizer04/Telerik-Academy-2013-2014", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "JS/Practice-JS/Practice-JS/Problem1 - MaxSum/scripts.js", "max_forks_repo_name": "kaizer04/Telerik-Academy-2013-2014", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.3125, "max_line_length": 58, "alphanum_fraction": 0.432038835}
﻿

function solve(params) {

    var n = parseInt(params[0]);
    
    var sum = parseInt(params[1]);
    var maxSum = parseInt(params[1]);
    var begin = 1;
    var finalBegin = 1;
    var end = 1;
    
    for (var i = 2; i <= n; i++) {
        sum = sum + parseInt(params[i]);
        //console.log(sum);
        if (params[i] > sum) {
            sum = parseInt(params[i]);
            begin = i;
        }

        if (sum > maxSum) {
            maxSum = sum;
            finalBegin = begin;
            end = i;
        }
    }

    return maxSum;
}


console.log(solve(['6', '1', '3', '-5', '8', '7', '-6']));