---
title: "Discussion on \"LC: 121 Best Time To Buy and Sell Stock I\" | Hashnode"
description: "Discussion on \"LC: 121 Best Time To Buy and Sell Stock I\". Input: prices = [7,1,5,3,6,4] Output: 5 Explanation: Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6-1 = 5. Note that buying on day 2 and selling on day 1 is not allowed because you must buy before you sell.\n\nHere's a breakdown of ..."
url: "https://hashnode.com/posts/lc-121-best-time-to-buy-and-sell-stock-i/643d102ecf90aba071184b58"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [LC: 121 Best Time To Buy and Sell Stock I](https://ankushsrj.hashnode.dev/lc-121-best-time-to-buy-and-sell-stock-i?utm_source=hashnode&utm_medium=feed)

Input: prices = \[7,1,5,3,6,4\] Output: 5 Explanation: Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6-1 = 5. Note that buying on day 2 and selling on day 1 is not allowed because you must buy before you sell. Here's a breakdown of ...

Apr 17, 2023 · 2 min read · ankushsrj.hashnode.dev  
Read the article

-   [#two-pointers](https://hashnode.com/tag/two-pointers)
-   [#stocks](https://hashnode.com/tag/stocks)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#dsa](https://hashnode.com/tag/dsa)
-   [#faang](https://hashnode.com/tag/faang)

## Written by

[TopGun](https://hashnode.com/@ankushsrj)

@ankushsrj

  
[View profile](https://hashnode.com/@ankushsrj)

Danger Zone

Firestone

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
