Skip to content

Problem description - 122. Best Time to Buy and Sell Stock II #32136

@Ggg93

Description

@Ggg93

LeetCode Username

g93

Problem Number, Title, and Link

  1. Best Time to Buy and Sell Stock II. https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii

Bug Category

Problem description

Bug Description

Current description of the problem:

You are given an integer array prices where prices[i] is the price of a given stock on the ith day.

On each day, you may decide to buy and/or sell the stock. You can only hold at most one share of the stock at any time. However, you can buy it then immediately sell it on the same day.

Find and return the maximum profit you can achieve.

Issue:

The highlighted sentence is confusing. Literally, it suggests that buying and immediately selling at the same price could be a meaningful operation, which is not the case.

Proposed wording:

After selling a stock, you are allowed to buy it again on the same day if you wish.

This clarifies that the intention is to allow selling and then opening a new position on the same day, rather than encouraging meaningless buy-then-sell transactions.

Language Used for Code

None

Code used for Submit/Run operation

Expected behavior

Problem description should be:

You are given an integer array prices, where prices[i] is the price of a given stock on the i-th day.

You may complete as many transactions as you like, but you may hold at most one share of the stock at any time.
After selling a stock, you are allowed to buy it again on the same day if you wish.

Find and return the maximum profit you can achieve.

Screenshots

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions