Problem statement

https://binarysearch.com/problems/3-and-7/

Solution

It can be proved by induction that all numbers except 1, 2, 4, 5, 8, 11 can be made.

Complexity

It is O(1) for time and space.

Code

class Solution:
    def solve(self, n):
        return n not in [1, 2, 4, 5, 8, 11]