Buy and Sell Stock variation

Asked atFreshwoks
1Give yourself 5 minutes
2Answer out loud, not in your head
3Then compare with the answer below
0
Stuck? Show a way to structure it+
  1. 01Ask which stock variation is intended.
  2. 02Define hold and cash states.
  3. 03Add states only for the stated restriction.
  4. 04Update each day from prior-day values.
  5. 05State the matching complexity.

Reference answer

Then expect these follow-ups

  • How does a one-day cooldown change the states?

    Tests: constraint adaptation

  • How would you handle at most k transactions?

    Tests: follow-up reasoning

Hiring now

Freshwoks has 111 open roles right now

landed applies to roles like these for you, on each company’s own site, with answers written for the role.

Get 5x interviews10 free auto-applies. No card.
  • Lead Software Engineer - Site Reliability

    Hyderabad, TS, India

  • Head of Solution Engineering, Americas

    San Mateo, CA, United States

  • Lead - Solution Engineer

    Remote

Or practice this question first

Next question