makes10

Easy · Basic Logic · 5 test cases

Given 2 ints, a and b, return true if one of them is 10 or if their sum is 10.

Examples

makes10(9, 10) → true
makes10(9, 9) → false
makes10(1, 9) → true

Starter code

function makes10(a, b) {

}

Complexity of the optimal solution

Time O(1), space O(1). The function performs a few comparisons and an addition. These operations take constant time, regardless of the input values. It uses a fixed amount of memory.

Solve makes10 in the browser