toast logo
Toast· SDE-2

TOAST round-1 Question - SDE-2

Posted
17 Mar 2026
309 reads

Summary

I encountered a specific algorithmic problem, 'Maximum Profit with 5-Day Selling Constraint', during my Round 1 SDE-2 interview at Toast.

How it went

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.

Questions asked (1)

  1. 01

    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.

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Toast recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!