TOAST round-1 Question - SDE-2
Summary
I encountered a specific algorithmic problem, 'Maximum Profit with 5-Day Selling Constraint', during my Round 1 SDE-2 interview at Toast.
Full Experience
Problem: Maximum Profit with 5-Day Selling Constraint
You are given two integer arrays cost and sales, where:
cost[i]represents the cost of making a sourdough bread on dayisales[i]represents the selling price of bread on dayi
Constraint:
A bread made on day i can only be sold on or after day i + 5.
Goal:
Return the maximum profit achievable by choosing one day to make the bread and a valid future day to sell it.
If no profit is possible, return 0.
Interview Questions (1)
Maximum Profit with 5-Day Selling Constraint
You are given two integer arrays cost and sales, where:
cost[i]represents the cost of making a sourdough bread on dayisales[i]represents the selling price of bread on dayi
Constraint: A bread made on day i can only be sold on or after day i + 5.
Goal: Return the maximum profit achievable by choosing one day to make the bread and a valid future day to sell it.
If no profit is possible, return 0.