-
Notifications
You must be signed in to change notification settings - Fork 70
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
Sum Earnings #8
Comments
@rosdyana hey thanks for the new challenge! i think you forgot the goal / challenge of the problem. would this be correct?
|
@the-vampiire yeah, you're correct 👍 |
In the test data, can you explain why the streak is 5?
I think it should be 4 starting on the 1st day and ending on the 2nd day. |
hi @mikelane , it's 5 because the spending (-2) is less than earning (1+3), he still have $2 , so it's not broke the rules. |
Should this be able to handle float values? |
Sum Earnings issue for the beginners solved
Challenge
We have a list in string type separated by commas that represented buy or sell activity. Positive value for selling and negative value for buying activity.
For example, in the following string, this user sold something for $7 on the 2nd day, and something for $2 on the 4th day, and then bought something for $12 on the 5th day, and so on.
0,7,0,2,-12,3,0,2
This user's highest earnings streak is $5, which started on the 6th day and ended on the 8th day. The streak does not start before the 6th day because the user spent $12 on the 5th and broke earlier streak on $9.
test data
input:
1,3,-2,1,2
output:
5
input:
0,7,0,2,-12,3,0,2
output:
5
starter code
notes
qwerty
,,3,,4
1,2,v,b,3
The text was updated successfully, but these errors were encountered: