sleepIn

Easy · Basic Logic · 4 test cases

The weekday variable indicates whether it's a weekday (true) or not (false), and the vacation variable signifies if we are on vacation (true) or not (false). We choose to sleep in if it's either a weekend or if we're on vacation. Return true if we decide to sleep in.

Examples

sleepIn(false, false) → true
sleepIn(true, false) → false
sleepIn(false, true) → true

Starter code

function sleepIn(weekday, vacation) {

}

Complexity of the optimal solution

Time O(1), space O(1). The solution uses a single boolean expression. The time to evaluate it is constant and does not depend on the size of any input. It uses a fixed amount of memory.

Solve sleepIn in the browser