简体中文
Telegram

帖子def transform_to_smallest_prime( input1, input2):

2025年9月15日
D
Deloitte | COGNIZANT | IBM | CAPGEMINI
def transform_to_smallest_prime( input1, input2): from collections import deque N, K = str(input1), input2 n = len(N) def is_prime(x): if x < 2: return False if x % 2 == 0 and x != 2: return False d = 3 while d * d <= x: if x % d == 0: return False d += 2 return True q = deque([(N, 0)]) seen = {N: 0} best_prime = None while q: cur, steps = q.popleft() if steps <= K: val = int(cur) if cur[0] != '0' and is_prime(val): if best_prime is None or val < best_prime: best_prime = val if steps < K: for i in range(n): d = int(cur[i]) for nd in [d - 1, d + 1]: if 0 <= nd <= 9: nxt = cur[:i] + str(nd) + cur[i+1:] if nxt not in seen or seen[nxt] > steps + 1: seen[nxt] = steps + 1 q.append((nxt, steps + 1)) return best_prime if best_prime is not None else -1 //prime transformation✅✅ VIRTUSA✅
682 ·

信息流中的邻近内容

DDeloitte | COGNIZANT | IBM | CAPGEMINIfrom collections import deque def minMovesToHospital(cls, input1, input2, input3): N = input1 E = input2 K = input3 - 1 if E[K] == 0: return 0 visited = [False]DDeloitte | COGNIZANT | IBM | CAPGEMINIdef maximizeQuality(cls, input1, input2, input3): n = input1 R = input2 P = input3 X = [] for b in range(32): mask = 1 << b contrib = 0 for val in P:
这条消息
DDeloitte | COGNIZANT | IBM | CAPGEMINIdef longest_decay_path(input1, input2, input3, input4, input5): N, M = input1, input2 grid = input3 start_x, start_y = input4, input5 directions = [(-1, 0), (1,DDeloitte | COGNIZANT | IBM | CAPGEMINIdef find_equal_biomass_cut(input1, input2, input3): n = input1 biomass = input2 edges = input3 graph = [[] for _ in range(n)] for u, v in edges: g

来自搜索索引的公开信息流 ChatCrawler ——“公开 Telegram 的 Google”;随着该社群被抓取而更新。 时间为 UTC。

仅限公开内容,使用 Telegram 官方 API。 关于 · 常见问题 · 索引限制 · 移除页面 · 目录 · 搜索 · 计算方法