import mathconnected sum // honeywell
from collections import defaultdict, deque
def connectedSum(graph_nodes, graph_from, graph_to):
graph = defaultdict(list)
for u, v in zip(graph_from, graph_to):
graph[u].append(v)
graph[v].append(u)
visited = set()
def bfs(node):
queue = deque([node])
visited.add(node)
component_size = 0
while queue:
current = queue.popleft()
component_size += 1
for neighbor in graph[current]:
if neighbor not in visited:
visited.add(neighbor)
queue.append(neighbor)
return component_size
total_sum = 0
for node in range(1, graph_nodes + 1):
if node not in visited:
component_size = bfs(node)
total_sum += math.ceil(math.sqrt(component_size))
return total_sum
👌2
def maxTickets(tickets):
tickets.sort()
max_len = 1
curr_len = 1
for i in range(1, len(tickets)):
if abs(tickets[i] - tickets[i - 1]) <= 1:
curr_len += 1
else:
max_len = max(max_len, curr_len)
curr_len = 1
return max(max_len, curr_len)
Picking tickets// Honeywell
❤1
from collections import deque
def photoAlbum(index, identity):
album = deque()
for i in range(len(index)):
album.insert(index[i], identity[i])
return list(album)
Photo album // Honeywell
❤1
Ey GDS
On-campus placement
All MCQ & Coding are done ✅
DM @mrtrueliving_ix 👍
All placement help available
On-campus placement
All MCQ & Coding are done ✅
DM @mrtrueliving_ix 👍
All placement help available
Wipro slots are open 👐
DM @mrtrueliving_ix 🤗
💯 Test Clearance no Doubt for that
9am
12pm
3pm
6pm
Preview:
https://t.me/code_alphix/2143
Test Clearance 💯🙂
DM @mrtrueliving_ix 🤗
💯 Test Clearance no Doubt for that
9am
12pm
3pm
6pm
Preview:
https://t.me/code_alphix/2143
Test Clearance 💯🙂
Capgemini slots are available now
DM @mrtrueliving_ix😊
💯 Test Clearance 😉
https://t.me/code_alphix/2605
DM fast ⏩⏩⏩
DM @mrtrueliving_ix😊
💯 Test Clearance 😉
https://t.me/code_alphix/2605
DM fast ⏩⏩⏩
This media is not supported in your browser
VIEW IN TELEGRAM
This media is not supported in your browser
VIEW IN TELEGRAM
This media is not supported in your browser
VIEW IN TELEGRAM