Darwinbox Interview Experience | Process, Pay Details & Tips | On-Campus Process | 2025 Batch

  Рет қаралды 1,358

Code With U-DAY

Code With U-DAY

Күн бұрын

Пікірлер: 10
@sivaganeshatmakuri7635
@sivaganeshatmakuri7635 Ай бұрын
Nice job guys
@ajayvempati237
@ajayvempati237 Ай бұрын
how to construct the graph for 1st question in coding round2
@Chotu-v8c
@Chotu-v8c Ай бұрын
Did you get it?
@csec0565
@csec0565 Ай бұрын
from collections import deque # Function to add an edge between two nodes in the adjacency list def add_edge(adj, u, v): adj[u].append(v) adj[v].append(u) # Function to generate the figure/grid structure def generate_grid(n): fig = [[] for _ in range(n+1)] # Create a list of lists to hold grid structure start = 1 # For the growing half for i in range(1, n//2+1): for j in range(1, i*2): fig[i].append(start) start += 1 # For the shrinking half for i in range(n//2+1, n + 1): for j in range(1, (n-i+1)*2): fig[i].append(start) start += 1 return fig # Function to add edges in each row of the grid def add_row_edges(fig, adj, n): for i in range(1, n+1): for j in range(len(fig[i]) - 1): add_edge(adj, fig[i][j], fig[i][j+1]) # Function to add vertical edges between specific rows in the grid def add_diagonal_edges(fig, adj, n): # For the growing half for i in range(1, n//2): for j in range(len(fig[i])): if not((i%2) ^ fig[i][j] % 2): add_edge(adj, fig[i][j], fig[i][j] + i * 2) # For the middle row for j in range(len(fig[n//2])): if not((n//2 % 2) ^ fig[n//2][j] % 2): add_edge(adj, fig[n//2][j], fig[n//2][j] + n - 1) # For the shrinking half for i in range(n, n//2, -1): # Corrected to reverse order for j in range(len(fig[i])): if not((i%2) ^ fig[i][j] % 2): add_edge(adj, fig[i][j], fig[i][j] - (n - i + 1) * 2) # BFS function to calculate distances from node k def bfs(adj, k, tot_n): q = deque([k]) dist = [-1] * (tot_n+1) dist[k] = 0 while q: node = q.popleft() for neighbor in adj[node]: if dist[neighbor] == -1: dist[neighbor] = dist[node] + 1 q.append(neighbor) return dist # Input handling and main execution n, k = map(int, input().split()) fig = generate_grid(n) tot_n = sum(len(row) for row in fig) # Total number of nodes adj = [[] for _ in range(tot_n+1)] # Add edges between nodes add_row_edges(fig, adj, n) add_diagonal_edges(fig, adj, n) # Perform BFS and print the distances distances = bfs(adj, k, tot_n) print(distances[1:])
@QuirkNinja-md8in
@QuirkNinja-md8in 27 күн бұрын
how many days it took to get notification after interview. i have completed my interview on 16th .
@U-DAY
@U-DAY 27 күн бұрын
@@QuirkNinja-md8in it would take more than a week
@AnyTimeMovie-forU
@AnyTimeMovie-forU 27 күн бұрын
hii i got shortlisted for the 2nd round virtual interview .... can you tell how the interview will be and what questions were asked
@U-DAY
@U-DAY 27 күн бұрын
www.linkedin.com/in/sri-varshith-singampalli-8a38a9253? You can ping him
@achiever8006
@achiever8006 Ай бұрын
when was his placement completed?
@U-DAY
@U-DAY Ай бұрын
@@achiever8006 In September
How Strong is Tin Foil? 💪
00:25
Brianna
Рет қаралды 72 МЛН
Can You Find Hulk's True Love? Real vs Fake Girlfriend Challenge | Roblox 3D
00:24
Мама у нас строгая
00:20
VAVAN
Рет қаралды 6 МЛН
Darwinbox Interview Experience | 16LPA | Darwinbox Interview Questions
11:29
Big O of One Coding Club
Рет қаралды 12 М.
SAE Podcast S01 E07 :Porsche : Origins and Beyond
49:50
Wells Fargo
36:23
Shanmugaraj Raja
Рет қаралды 2
My Unconventional Coding Story | Self-Taught
27:14
Travis Media
Рет қаралды 660 М.
The Best Routine (Explained by a 23yo Muslim CEO)
30:56
Thom J. Défilet – Halal Business
Рет қаралды 354 М.
How to: Work at Google - Example Coding/Engineering Interview
24:02
Life at Google
Рет қаралды 7 МЛН
How Strong is Tin Foil? 💪
00:25
Brianna
Рет қаралды 72 МЛН