Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for [old] Call to Home by vincent.tscherter
"use strict";
function totalCost(calls){
calls.push('guard 0 0');
var i = 0, day = calls[0].split(' ')[0], cday, foo, dur, sum = 0, durs = [];
while (i a +( b<101 ? b : 100 + (b-100)*2), 0);
}
var assert = require('assert');
if (!global.is_checking) {
assert.equal(totalCost(["2014-01-01 01:12:13 181",
"2014-01-02 20:11:10 600",
"2014-01-03 01:12:13 6009",
"2014-01-03 12:13:55 200"]), 124, "Base example");
assert.equal(totalCost(["2014-02-05 01:00:00 1",
"2014-02-05 02:00:00 1",
"2014-02-05 03:00:00 1",
"2014-02-05 04:00:00 1"]), 4, "Short calls but money...");
assert.equal(totalCost(["2014-02-05 01:00:00 60",
"2014-02-05 02:00:00 60",
"2014-02-05 03:00:00 60",
"2014-02-05 04:00:00 6000"]), 106, "Precise calls");
console.log("Coding complete? Click 'Check' to review your tests and earn cool rewards!");
}
June 29, 2017
Comments: