You are viewing a single comment's thread. Return to all comments →
def solve(n): queue = deque(['9']) visited = set() while queue: current = queue.popleft() current_num = int(current) if current_num % n == 0: return current next_num1 = current + '0' next_num2 = current + '9' if next_num1 not in visited: queue.append(next_num1) visited.add(next_num1) if next_num2 not in visited: queue.append(next_num2) visited.add(next_num2)
Seems like cookies are disabled on this browser, please enable them to open this website
Special Multiple
You are viewing a single comment's thread. Return to all comments →