【Edabit 算法 ★☆☆☆☆☆】 Basketball Points
language_fundamentals
math
numbers
Instructions
Examples
points(1, 1) // 5
points(7, 5) // 29
points(38, 8) // 100
Notes
- N/A
Solutions
function points(twoPointers, threePointers) {
return twoPointers * 2 + threePointers * 3 ;
}
TestCases
let Test = (function(){
return {
assertEquals:function(actual,expected){
if(actual !== expected){
let errorMsg = `actual is ${actual},${expected} is expected`;
throw new Error(errorMsg);
}
}
}
})();
Test.assertEquals(points(1, 1), 5)
Test.assertEquals(points(1, 2), 8)
Test.assertEquals(points(2, 1), 7)
Test.assertEquals(points(2, 2), 10)
Test.assertEquals(points(69, 420), 1398)