-
Notifications
You must be signed in to change notification settings - Fork 493
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
Comments
Hii I am a GSSoC'22 participant |
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 !! |
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. |
Ok Sure I will add solution |
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. |
Ok, will try to complete this by today. |
this commit resolves the Lakhankumawat#70 issue
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. |
/assign |
This issue has been assigned to OmarAdelBadawy0! |
Everything has already been done just few minimal conflicting changes are remaining |
/assign |
The issue is already assigned! |
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
The text was updated successfully, but these errors were encountered: