Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stock Buy And Sell #70

Closed
1 task done
PrashantVIT1 opened this issue Feb 28, 2022 · 12 comments
Closed
1 task done

Stock Buy And Sell #70

PrashantVIT1 opened this issue Feb 28, 2022 · 12 comments

Comments

@PrashantVIT1
Copy link
Contributor

Description

Stock Buy And Sell
Problem Statement: You are given an array of prices where prices[i] is the price of a given stock on an ith day.

You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock. Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.

Examples:

Example 1:

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.

Example 2:

Input: prices = [7,6,4,3,1]

Output: 0

Explanation: In this case, no transactions are done and the max profit = 0.

Domain

Competitive Programming

Type of Contribution

Addition

Code of Conduct

@PrashantVIT1
Copy link
Contributor Author

Hii I am a GSSoC'22 participant

@Lakhankumawat
Copy link
Owner

hi @PrashantVIT1 thanks for reaching me out but problem statements are not accepted in this project as GSSOC'22 contribution cause anyone you know can copy a problem from leetcode , paste solution in PR and can create such PR's which won't be a valid contribution , you can see what are the issues in the accepted issues , they have a algorithm dedicated , so i recommend you come up with something else .

Happy Coding !!

@Lakhankumawat
Copy link
Owner

you can contribute this issue to the repo if you want to but it won't be counted in your point for GSSOC'22 but i recommend you contribute this issue instead of closing because you'll learn from it.

@Lakhankumawat Lakhankumawat reopened this Feb 28, 2022
@PrashantVIT1
Copy link
Contributor Author

Ok Sure I will add solution

@github-actions
Copy link

github-actions bot commented Mar 8, 2022

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@PrashantVIT1
Copy link
Contributor Author

Ok, will try to complete this by today.
Thanks for reminder

@PrashantVIT1 PrashantVIT1 mentioned this issue Mar 9, 2022
10 tasks
PrashantVIT1 added a commit to PrashantVIT1/LearnCPP that referenced this issue Mar 12, 2022
@PrashantVIT1
Copy link
Contributor Author

I want to close this issue as there is no response on pull request that I had created. Kindly look into this otherwise I will have to close it.

@OmarAdelBadawy0
Copy link

/assign

@github-actions
Copy link

This issue has been assigned to OmarAdelBadawy0!
It will become unassigned if it is not closed within 12 days. A maintainer can also add the pinned label to prevent it from being unassigned.

@PrashantVIT1
Copy link
Contributor Author

Everything has already been done just few minimal conflicting changes are remaining

@PrashantVIT1
Copy link
Contributor Author

/assign

@github-actions
Copy link

The issue is already assigned!
Please find/create a new issue to contribute to.
You can safely disregard the failed workflow notification for this issue. ❌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants