Skip to content

Swiggy Coding Questions - DSA Problems & Solutions

Practice Swiggy placement paper coding questions with detailed solutions. Access Swiggy OA coding problems in Java, Python, JavaScript.

This page contains Swiggy coding questions from Swiggy OA placement papers with detailed solutions.

Swiggy OA Coding Section:

  • Problems: 2-3 coding problems
  • Time: 90 minutes
  • Languages: Java, Python, JavaScript
Q1: Optimize delivery routes for multiple orders.

Solution (Java):

public List<Order> optimizeDeliveryRoute(List<Order> orders, Location restaurant) {
// Use nearest neighbor algorithm
List<Order> route = new ArrayList<>();
Location current = restaurant;
Set<Order> remaining = new HashSet<>(orders);
while (!remaining.isEmpty()) {
Order nearest = findNearestOrder(current, remaining);
route.add(nearest);
current = nearest.deliveryLocation;
remaining.remove(nearest);
}
return route;
}

Time Complexity: O(n²)


Practice Swiggy coding questions regularly!