Backend Engineer

Ad Selection

Ad Selection

Select which ads should be run on your website to maximize revenue, taking into account the associated cost and user experience.

You are a Backend Engineer tasked with optimizing the placement and selection of advertisements on a popular web platform. Your goal is to maximize the click-through rate (CTR) and revenue generated from ads while ensuring a good user experience. This includes not overwhelming users with too many ads and ensuring that the ads shown are relevant to the users. You have access to historical data on ad performance and user engagement. Additionally, you must decide whether to display high-revenue but low-CTR ads or low-revenue but high-CTR ads on specific pages, adding complexity to your optimization.

Objective: Maximize revenue

Constraints:

- Overall CTR Constraint: Ensure the average CTR remains above 2.5%.
- Page CTR Constraint: If an ad with a CTR below 2.0% is selected, it must be accompanied by at least one ad with a CTR above 3.0% on the same page.
- User Experience Constraint: No more than 3 ads per page.
- Relevance Constraint: At least 70% of the ads shown must match user interests.
- Budget Constraint: The total cost of ads displayed should not exceed $500 per day.

 You can find the data in the enclosed table, the columns are: Page ID,Ad ID,CTR (%),Revenue per click ($),User Interest Match (Yes/No),Cost per ad ($)

A/B Testing

A/B Testing

Choose from a pool of A/B variants and allocate different user segments to them to minimize user disruption while upholding statistical significance.

You are a backend engineer at a software company preparing to conduct A/B tests on a new feature. The goal is to determine the optimal selection of three out of ten possible test variants (V1 to V10) and allocate different user segments to these chosen variants.

Objective:
Minimize the total user disruption

- Selection constraint: Choose three out of ten possible variants.
- Minimum users for statistical significance: Each chosen variant must have at least 100 users in each user segment.
- Total users: Make all users from each segment are allocated to the variants that end up being chosen.
- Balance constraint: Within each user segment, the difference of allocation between any two variants cannot be more than 300

Data:
The user segments and disruptions can be found in ab_testing.csv and has the following columns: User Segment,Total Users,Disruption in V1,Disruption in V2,Disruption in V3,Disruption in V4,Disruption in V5,Disruption in V6,Disruption in V7,Disruption in V8,Disruption in V9,Disruption in V10

Backend API Routing

Backend API Routing

Route the network from end-users to first and second-degree internal servers, minimizing latency while maintaining low cost and a reliability SLA.

You are a Backend Engineer tasked with optimizing the configuration and routing rules of an API gateway to ensure efficient handling of requests, reduce latency, and improve the reliability of backend services. The API gateway routes incoming requests to different backend services, each with varying processing times, reliability, and costs. Your goal is to distribute the requests in such a way that minimizes the total latency while meeting the reliability requirements and keeping the cost within budget.

You have five backend services (Service A, Service B, Service C, Service D, and Service E) and need to determine the percentage of requests to route to each service. Each service has a known average processing time, reliability rate, and cost per request. After the initial routing to these backend services, the requests are then routed to a second layer of gateways (F, G, H, I, J, K, L, M, N), with specific routes between the initial services and the internal gateways. Each route has an associated additional processing time, reliability rate, and cost per request.

Objective: Minimize the total latency of the API gateway system.

Constraints:

- Backend Reliability constraint: The weighted reliability of the Backend Services must be at least 99.5%.
- Internal Reliability constraint: The weighted reliability of the Internal Gateways must be at least 99.5%.
- Backend Routing constraint: The sum of the routing percentages to the Backend Services must equal 100% and no route may take up more than 40%.
- Internal Routing constraint: For each of the routes starting at the same Backend Service, the sum of the routing percentages must equal 100% and no route may take up more than 75%. This means we need to have separate constraints for routes starting at A,B,C,etc.
- Cost constraint: The average cost across all requests must not exceed $0.40.
- Non-negativity constraint: The routing percentages must be non-negative.
- Routing constraints between layers: Specific backend services can only route to certain gateways as defined in the data.

Data:
The Backend Services can be found in network_routing_backend.csv and has the following columns: Service,Average Processing Time (ms),Reliability (percentage),Cost per Request ($)
The Routing from Backend Services to Internal Gateways can be found in network_routing_internal.csv and has the following columns: Backend Service,Internal Gateway,Additional Processing Time (ms),Additional Reliability (percentage)

E-Commerce Pricing

Backend API Routing

Determine the optimal sales price for the items on an E-commerce platform.

You are a backend engineer at an e-commerce company tasked with optimizing pricing strategies for a range of electronic products. Your goal is to maximize the total revenue while considering the supply, demand, customer behavior and shipping costs.

Objective: Maximize total revenue
Constraints:

- Stock Availability: The total quantity of each product sold cannot exceed the available stock.
- Demand Elasticity: The demand for each product decreases as the price increases. Use the demand elasticity equation for this.
- Shipping Costs: Shipping costs are deducted from the revenue and vary based on the product size and weight. Use the shipping costs equation for this.
- Minimum Price Constraint: Prices must be at least 80% of the base price to ensure profitability.

Equations:
- Demand elasticity: Q = Q0 * (1 - E * ((P-P0)/P0)) with Q being the demand, Q0 base demand, P0 base price, P new price and E the price elasticity
- Shipping costs: SC = Base Shipping Cost + ((2×Size (kg))+(1.5×Weight (kg)) * units sold)

The data is enclosed. The headers are: Product ID,Product Name,Stock Quantity,Base Demand,Base Price,Size (kg),Weight (kg),Base Shipping Cost,Price Elasticity