0% found this document useful (0 votes)
8 views4 pages

E-commerce Algorithm Challenges Overview

Uploaded by

Yash shank17
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views4 pages

E-commerce Algorithm Challenges Overview

Uploaded by

Yash shank17
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Problem Statements

1. Product Price Optimization (Array / Prefix Sum)


An e-commerce store updates prices frequently.​
Given a list of n price changes in the form:

[ (startIndex, endIndex, priceIncrement) ]

Apply all increments efficiently and return the final price list.

Constraints:​
n ≤ 10^5​
Use difference array + prefix sum.

2. Detect Cyclic Dependencies Between Plugins (Graph /


Cycle Detection)
Hummingbird builds Magento plugins that depend on each other.

Given a directed graph of plugin dependencies, detect if there is a circular dependency.

Return:

●​ True → cycle exists​

●​ False → no cycle​

Use DFS + recursion stack.

3. Order Processing Queue (Queue / Scheduling)


Customer orders arrive with priorities:

(orderId, processingTime, priority)


Process orders by:

1.​ Highest priority​

2.​ If same → lowest processing time​

3.​ If same → smallest orderId​

Return the order processing sequence.

Implement using a Priority Queue (Heap).

4. API Rate Limiter (Sliding Window / Queue)


The backend allows 100 API calls per user per minute.

Given timestamps of API calls for a user (sorted), find how many requests should be blocked.

Use sliding window.

5. Warehouse Stock Refill Prediction (DP / LIS)


Given daily stock data for a SKU, determine the longest period of consecutive increase in
inventory.

Return the length of longest increasing subsequence (continuous).

6. Validate Product URL Structure (String / Stack)


A valid product URL follows:

/category/subcategory/product-name

Rules:
●​ No double slashes​

●​ No spaces​

●​ Only letters, digits, hyphens​

Validate using string parsing or stack.

7. Merge Customer Sessions (Intervals)


A customer may browse multiple sessions in a day.

Given intervals:

[startTime, endTime]

Merge overlapping sessions and return:

●​ Merged intervals​

●​ Total active time​

Use interval merging.

8. Suggest Related Products (HashMap / Frequency


Counting)
Input: order history​
Each order = list of product IDs.

For a given product P, return the top 5 items most frequently bought together with P.

Use:

●​ HashMap<product, frequency>​
●​ Sorting or min-heap​

9. Optimize Delivery Route (Graph / BFS)


Warehouse has picking stations connected by paths.​
Given start station S and target station T, find the minimum number of steps to reach T.

Graph is unweighted → Use BFS.

10. Product Inventory Threshold Alerts (Binary Search /


Greedy)
Given sorted inventory levels for multiple SKUs over days, find the first day inventory falls
below threshold X.

Use binary search on sorted array.

You might also like