---
title: "Discussion on \"121. Best Time to Buy and Sell Stock(Java, Easy, O(n))\" | Hashnode"
description: "Discussion on \"121. Best Time to Buy and Sell Stock(Java, Easy, O(n))\". Track the minPrice and update maxProfit if (price-minPrice)>maxProfit"
url: "https://hashnode.com/posts/121-best-time-to-buy-and-sell-stockjava-easy-on/686a914f578347a8421c1f88"
---

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

Discussion

# [121\. Best Time to Buy and Sell Stock(Java, Easy, O(n))](https://huanganni.hashnode.dev/121-best-time-to-buy-and-sell-stockjava-easy-on?utm_source=hashnode&utm_medium=feed)

Track the minPrice and update maxProfit if (price-minPrice)>maxProfit

Jul 6, 2025 · 5 min read · huanganni.hashnode.dev  
Read the article

-   [#java](https://hashnode.com/tag/java)
-   [#leetcode-solution](https://hashnode.com/tag/leetcode-solution)
-   [#leetcode-easy](https://hashnode.com/tag/leetcode-easy)

## Written by

[Anni Huang](https://hashnode.com/@HuangAnni)

@HuangAnni · Singapore

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

LLM Training Operation Specialist @ ByteDance | Ex-Master of IT in Business (AI track) at SMU

I’m Anni Huang, an AI researcher-in-training currently at ByteDance, specializing in LLM training operations with a coding focus. I bridge the gap between engineering execution and model performance, ensuring the quality, reliability, and timely delivery of large-scale training projects.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
