Walmart 2024 Papers
Previous year papers with coding questions
Practice Walmart placement paper coding questions with detailed solutions. Access Walmart OA coding problems in Java, Python.
This page contains Walmart coding questions from Walmart OA placement papers with detailed solutions.
Walmart OA Coding Section:
Solution (Java):
public int minDeliveryTime(int[][] graph, int source, int destination) { int n = graph.length; int[] dist = new int[n]; Arrays.fill(dist, Integer.MAX_VALUE); dist[source] = 0;
PriorityQueue<int[]> pq = new PriorityQueue<>((a, b) -> a[1] - b[1]); pq.offer(new int[]{source, 0});
while (!pq.isEmpty()) { int[] curr = pq.poll(); int node = curr[0], time = curr[1];
if (node == destination) return time;
for (int i = 0; i < n; i++) { if (graph[node][i] > 0) { int newTime = time + graph[node][i]; if (newTime < dist[i]) { dist[i] = newTime; pq.offer(new int[]{i, newTime}); } } } }
return -1;}Time Complexity: O((V + E) log V)
Walmart 2024 Papers
Previous year papers with coding questions
Walmart Main Page
Complete Walmart placement guide
Practice Walmart coding questions regularly!