January 13, 2026

Identifying the Top 10 Sellers for Featured Promotions (E-commerce Platform)

E-commerce platforms frequently rank sellers to decide featured placements, promotions, and incentives.

This problem simulates a real-world backend/data scenario where seller performance is distributed across multiple months and must be evaluated using business rules.


๐Ÿ“Œ Problem Statement

An e-commerce platform wants to identify the Top 10 sellers for featured promotions based on their performance over the last 3 months.


๐Ÿ“‚ Data Sources

  • jan_orders.csv

  • feb_orders.csv

  • mar_orders.csv

Each Record

(sellerId, orderValue, customerRating)

Each record represents one completed order.


✅ Selection Criteria

A seller is considered eligible only if all the following conditions are met:

  1. At least 100 total orders across all months

  2. Average customer rating ≥ 4.2

  3. At least 20 orders in EACH month

Ranking Rule


๐ŸŽฏ Expected Output

List<String> → sellerIds sorted by average order value (highest first)

๐Ÿง  Key Clarifications (Interview Gold)

Before coding, clarify these assumptions:

  • Customer rating is per order (not per seller)

  • Average rating = totalRatings / totalOrders

  • Average order value = totalOrderValue / totalOrders

  • A seller missing even one month is not eligible

  • ≥ 4.2 means 4.2 is allowed

These clarifications show strong analytical thinking.


๐Ÿ— High-Level Approach

Step 1: Aggregate seller data

Use a map:

sellerId → SellerSummary

Track:

  • order count per month

  • total order value

  • total rating sum


Step 2: Compute derived metrics

For each seller:

  • totalOrders

  • averageRating

  • averageOrderValue


Step 3: Apply eligibility rules

Filter sellers who fail any condition:

  • totalOrders < 100

  • any month < 20 orders

  • averageRating < 4.2


Step 4: Rank & select

  • Sort by average order value (DESC)

  • Pick top 10


๐Ÿงฉ Java Data Model (Interview-Ready)

class SellerSummary {
    String sellerId;

    int ordersJan, ordersFeb, ordersMar;
    double totalOrderValue;
    double totalRating;

    int totalOrders() {
        return ordersJan + ordersFeb + ordersMar;
    }

    double averageRating() {
        return totalOrders() == 0 ? 0 : totalRating / totalOrders();
    }

    double averageOrderValue() {
        return totalOrders() == 0 ? 0 : totalOrderValue / totalOrders();
    }

    boolean isEligible() {
        return totalOrders() >= 100
            && ordersJan >= 20
            && ordersFeb >= 20
            && ordersMar >= 20
            && averageRating() >= 4.2;
    }
}

๐Ÿง  Stream Pipeline (Conceptual)

sellers.values().stream()
    .filter(SellerSummary::isEligible)
    .sorted(Comparator.comparingDouble(
        SellerSummary::averageOrderValue).reversed())
    .limit(10)
    .map(s -> s.sellerId)
    .toList();

⏱ Time & Space Complexity

Let:

  • N = total number of orders

  • S = number of sellers

OperationComplexity
AggregationO(N)
FilteringO(S)
SortingO(S log S)
SpaceO(S)

This is optimal and production-ready.


❌ Common Mistakes to Avoid

  1. Averaging averages

    • Always calculate from totals

  2. Integer division

    • Use double for all averages

  3. Ignoring monthly constraints

    • Each month must meet minimum orders

  4. Using > instead of

    • Ratings are inclusive here

  5. Ranking before filtering

    • Eligibility must come first


๐Ÿš€ How to Extend This in Real Systems


๐Ÿงช Interview Follow-Up Questions

  • How would you handle seller fraud or fake ratings?

  • What if promotions require category-wise top sellers?

  • How would you optimize this for millions of orders/day?

  • Would you precompute rankings or calculate on demand?


✅ Final Takeaway

This problem tests more than coding:

✔ data modeling
✔ aggregation logic
✔ business rule enforcement
✔ ranking correctness
✔ scalability thinking

If you can clearly explain this flow, you demonstrate strong backend and system-level thinking—exactly what interviewers want.