Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imagine a variable history exist that contains COST/PROCEEDS
- These Cost/proceeds will be ccalled C_1, C_2, ..., C_n
- Imagine we are using ARK coin
- For elements in history:
- Search for last Cost/Proceeds which we will denote C1
- if C1 is positive:
- Store value of index for "last element"
- Search for next C_n that is a sell
- if found
- index-1 is the beginning of our interval
- if C1 is negative:
- Last value index is last eleemnt of the interval
- Find last sell, take index-1 as beginning of interval
- return sum of C_1 to C_n
Advertisement
Add Comment
Please, Sign In to add comment