Meta Variant for Buy Sell Stock (LC121)
3982

Hey y’all, as peeps are studying for their Meta loops within the next few months, I have a solution up for a popular one they ask, Leetcode problem 121 Best Time to Buy and Sell Stock as well as the actual variant.

Throughout the many interviewee posts in this forum, I’ve never seen the original Leetcode question asked (or at least anecdotally). Meta changes it up with a twist: what if you were given two vectors instead, and the context of the problem changes to purchasing departure and returning flight tickets?
IMO it’s a good one to be familiar with.

Check it out (or not!):

And for reference, here’s the previous post:
LC 162: Find Peak Element

As a quick note, we’re starting to include the Python code in the repository since people have been requesting it.

Reference to the OG LC problem: https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/

Good luck on your phone screens & onsite loops.

Comments (5)