Problem statement

https://binarysearch.com/problems/3-6-9/

Solution

Just simulate process.

Complexity

It is O(n) for time and space.

Code

class Solution:
    def solve(self, n):
        out = lambda x: "clap" if x%3 == 0 or str(x).count("6") + str(x).count("9") + str(x).count("3") > 0 else str(x) 
        return[out(x) for x in range(1, n+1)]