Seek Memory
Communications of the Artifacts of Creative Minds
Pages
Home
this
Binding
Tuesday, November 8, 2016
Average
My Code
var numberOfTests = 7; var testCase = { 0: function() { var ans = avg(0, 0); return ans == 0; }, 1: function() { var ans = avg(-1, 1); return ans == 0; }, 2: function() { var ans = avg(0, 1); return ans == 0.5; }, 3: function() { var ans = avg(2, 3); return ans == 2.5; }, 4: function() { var ans = avg(Number.MAX_VALUE, Number.MAX_VALUE); return ans == Number.MAX_VALUE; }, 5: function() { var ans = avg(Number.MIN_VALUE, Number.MIN_VALUE); return ans == Number.MIN_VALUE; }, 6: function() { var ans = avg(-Number.MAX_VALUE, Number.MAX_VALUE); return ans == 0; } } function test() { var pointsPerTest = 1; var possible = numberOfTests * pointsPerTest; var score = 0; for (var i=0; i
function avg(n1, n2) { return (n1+n2)/2; }
Your Code
function avg(n1, n2) { return "Implement Me!"; }
Hint
Ready
See also:
https://research.googleblog.com/2006/06/extra-extra-read-all-about-it-nearly.html
Newer Post
Older Post
Home