TOAST round-1 Question - SDE-2

toast logo
toast
· SDE-2
March 17, 2026 · 1 reads

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 day i
  • sales[i] represents the selling price of bread on day i

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)

1.

Maximum Profit with 5-Day Selling Constraint

Data Structures & Algorithms

You are given two integer arrays cost and sales, where:

  • cost[i] represents the cost of making a sourdough bread on day i
  • sales[i] represents the selling price of bread on day i

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.

📣 Found this helpful? Please share it with friends who are preparing for interviews!

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!