Backend Developer SDE 1 Meesho

meesho logo
meesho
Backend Developer SDE 1
May 18, 20256 reads

Summary

I recently interviewed with Meesho for a Backend Developer SDE 1 role. The process included an Online Assessment, a Low-Level Design round, and a High-Level Design discussion. I was ultimately rejected after the Hiring Manager round.

Full Experience

My Interview Experience at Meesho

I recently had the opportunity to interview with Meesho for a Backend Developer role. Thought I'd share my experience — it was a great learning process, and might be helpful to others preparing for similar rounds.

Round 1: Online Assessment (OA)

Total Questions: 3

Difficulty: 2 Medium, 1 Hard

I managed to fully solve 2 questions and partially solve 1 question.

Round 2: Low-Level Design (LLD)

This was a pure design round. The problem statement was:

Design a Shop Manager Application with coupon handling capabilities.

Some of the requirements:

  • Add products to inventory.
  • Create and manage carts.
  • Add items to cart.
  • Support two types of coupons: Flat and Percentage based.
  • Apply coupons to calculate final cart price.
  • Handle stock reduction on checkout.

import java.util.*;

// Product class class Product { private int productId; private String productName; private double price; private int quantity;

public Product(int productId, String productName, double price, int quantity) {
    this.productId = productId;
    this.productName = productName;
    this.price = price;
    this.quantity = quantity;
}

public int getProductId() { return productId; }
public String getProductName() { return productName; }
public double getPrice() { return price; }
public int getQuantity() { return quantity; }

public void reduceQuantity(int qty) {
    this.quantity -= qty;
}

}

// Item in the cart class Item { private int productId; private int quantity; private double price;

public Item(int productId, int quantity, double price) {
    this.productId = productId;
    this.quantity = quantity;
    this.price = price;
}

public int getProductId() { return productId; }
public int getQuantity() { return quantity; }
public double getPrice() { return price; }

}

// Cart class class Cart { private int cartId; private List<Item> items; private boolean active;

public Cart(int cartId) {
    this.cartId = cartId;
    this.items = new ArrayList&lt;&gt;();
    this.active = true;
}

public int getCartId() { return cartId; }
public List&lt;Item&gt; getItems() { return items; }
public boolean isActive() { return active; }
public void deactivate() { active = false; }

public void addItem(Item item) {
    items.add(item);
}

public double getCartPrice() {
    double total = 0;
    for (Item item : items) {
        total += item.getPrice() * item.getQuantity();
    }
    return total;
}

public double getCartPriceWithDiscount(Coupon coupon, int currentDate) {
    double cartPrice = getCartPrice();
    return cartPrice - coupon.calculateDiscount(cartPrice, currentDate);
}

}

// Abstract Coupon class abstract class Coupon { protected int couponId; protected double minimumPurchase; protected double maxDiscountLimit; protected int expiryDate; protected String couponName;

public Coupon(int couponId, double minimumPurchase, double maxDiscountLimit, int expiryDate, String couponName) {
    this.couponId = couponId;
    this.minimumPurchase = minimumPurchase;
    this.maxDiscountLimit = maxDiscountLimit;
    this.expiryDate = expiryDate;
    this.couponName = couponName;
}

public boolean isValid(int currentDate) {
    return currentDate &lt;= expiryDate;
}

public abstract double calculateDiscount(double cartPrice, int currentDate);

@Override
public String toString() {
    return "Coupon ID: " + couponId + ", Name: " + couponName;
}

}

// Percentage coupon class PercentageCoupon extends Coupon { private double percentageDiscount;

public PercentageCoupon(int couponId, double minimumPurchase, double maxDiscountLimit, int expiryDate, String couponName, double percentageDiscount) {
    super(couponId, minimumPurchase, maxDiscountLimit, expiryDate, couponName);
    this.percentageDiscount = percentageDiscount;
}

@Override
public double calculateDiscount(double cartPrice, int currentDate) {
    if (!isValid(currentDate) || cartPrice &lt; minimumPurchase) return 0;
    return Math.min((cartPrice * percentageDiscount) / 100.0, maxDiscountLimit);
}

}

// Flat coupon class FlatCoupon extends Coupon { private double flatDiscount;

public FlatCoupon(int couponId, double minimumPurchase, double maxDiscountLimit, int expiryDate, String couponName, double flatDiscount) {
    super(couponId, minimumPurchase, maxDiscountLimit, expiryDate, couponName);
    this.flatDiscount = Math.min(flatDiscount, maxDiscountLimit);
}

@Override
public double calculateDiscount(double cartPrice, int currentDate) {
    if (!isValid(currentDate) || cartPrice &lt; minimumPurchase) return 0;
    return flatDiscount;
}

}

// Manager class class ShopManager { private int cartIdCounter = 0; private Map<Integer, Product> inventory = new HashMap<>(); private Map<Integer, Cart> carts = new HashMap<>(); private Map<Integer, Coupon> coupons = new HashMap<>();

public void addProductToInventory(Product product) {
    inventory.put(product.getProductId(), product);
}

public void addCoupon(Coupon coupon) {
    coupons.put(coupon.couponId, coupon);
    System.out.println("Added coupon: " + coupon);
}

public int createCart() {
    for (Cart cart : carts.values()) {
        if (cart.isActive()) {
            return cart.getCartId();
        }
    }

    int cartId = cartIdCounter++;
    Cart newCart = new Cart(cartId);
    carts.put(cartId, newCart);
    return cartId;
}

public void addItemToCart(int cartId, int productId, int quantity) {
    Cart cart = carts.get(cartId);
    Product product = inventory.get(productId);

    if (product == null || product.getQuantity() &lt; quantity) {
        System.out.println("Insufficient stock or invalid product.");
        return;
    }

    Item item = new Item(productId, quantity, product.getPrice());
    cart.addItem(item);
}

public double calculateCartPriceWithCoupon(int cartId, int couponId, int currentDate) {
    Cart cart = carts.get(cartId);
    Coupon coupon = coupons.get(couponId);

    if (cart == null || coupon == null) {
        System.out.println("Invalid cart or coupon.");
        return 0;
    }

    return cart.getCartPriceWithDiscount(coupon, currentDate);
}

public void checkoutCart(int cartId) {
    Cart cart = carts.get(cartId);
    if (cart == null) return;

    for (Item item : cart.getItems()) {
        Product product = inventory.get(item.getProductId());
        product.reduceQuantity(item.getQuantity());
    }

    cart.deactivate();
    System.out.println("Cart " + cartId + " checked out.");
}

} public class ShoppingApp { public static void main(String[] args) { ShopManager shop = new ShopManager();

    // Add products
    shop.addProductToInventory(new Product(1, "T-Shirt", 1000, 10));
    shop.addProductToInventory(new Product(2, "Jeans", 2000, 5));

    // Add coupons
    shop.addCoupon(new FlatCoupon(1, 1500, 500, 30, "SUMMER30", 500));
    shop.addCoupon(new PercentageCoupon(2, 1000, 300, 30, "SPRING20", 20));

    // Create cart and add items
    int cartId = shop.createCart();
    shop.addItemToCart(cartId, 1, 1); // T-Shirt
    shop.addItemToCart(cartId, 2, 1); // Jeans

    // Calculate final price
    double totalPrice = shop.calculateCartPriceWithCoupon(cartId, 1, 25); // valid date
    System.out.println("Total price after discount: ₹" + totalPrice);

    // Checkout
    shop.checkoutCart(cartId);
}

}

Round 3: Hiring Manager (HM) Discussion

Started with a casual introduction and discussion around my current project experience.

Discussed challenges faced and solutions implemented in my recent backend services.

Then came a High-Level Design (HLD) problem:

Problem:
Design an e-commerce application for a mega sale event where:

  • 1000 items go live.
  • 1 billion users hit the system concurrently.

Discussion Points:

What possible issues could occur from a normal user's perspective?
I mentioned:

  • Service downtime
  • High latency
  • Cart synchronization problems
  • Inventory overselling
  • Payment gateway failures
    She was particularly interested in rare edge cases where user made the payment but didn't get the product so, need to solve this in futher discussion.

Discussed ways to handle this in a distributed system:

  • Using distributed locks / optimistic locking
  • Eventual consistency patterns
  • Caching strategies

HM round didn't go well for me...

Final verdict : Rejected

Interview Questions (2)

Q1
Design a Shop Manager Application with Coupon Handling
System Design

Design a Shop Manager Application with coupon handling capabilities.

Some of the requirements:

  • Add products to inventory.
  • Create and manage carts.
  • Add items to cart.
  • Support two types of coupons: Flat and Percentage based.
  • Apply coupons to calculate final cart price.
  • Handle stock reduction on checkout.
Q2
Design an E-commerce Application for a Mega Sale Event
System Design

Design an e-commerce application for a mega sale event where:

  • 1000 items go live.
  • 1 billion users hit the system concurrently.
Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!