Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Maybe because some programmers are programmed to program programmatically... rather than to think ;)
such problems don't score well on CW :(
@k2bralex - the input array represents the time series of the price of a company stock/share.
For simplicity, consider case with only 2 time periods - say
[3,17]
.If you bought one stock at time t=0 (index 0) and sold it at time t=1 (index 1) you would make a profit of 17 - 3 = 14. This is the maximum possible profit you can make with this input array.
Now if there are, say, 3 time periods - it becomes a bit more difficult:
[3,8,17]
for example: this allows you to buy one stock at time t=0 at price 3, and buy another stock at time t=1, at price 8, and then sell both stocks at time t=2 for price 17. What is total profit you made? It is (17-3) + (17-8) in this case.Now even more complicated is case like in description:
[ 1, 2, 10, 3, 2, 7, 3, 2 ]
where you might have to buy and sell at multiple times.I`m looking at this task 15 minutes and cant understand what is a process(((
This is more like a thinking problem than solving problem.
Your kata was actually already retired. The main reason being that it is a duplicate (see link below).
People are encouraged to write new katas, but you should check very carefully if your idea has been done before, before you write it (the quality control for beta katas is quite strict).
If you want to write more katas in the future, read this first
Yes, you right. I didn't find anything when I searched for something similar.
I removed JS.
(there is a bug about the very first publication of a kata, where some checks are lacking, hence the dummy translation can exist)
I wonder how it was even possible to publish javascript translation, (normally if reference solution fails on sample or full test cases, then one get error message of failure with mention of language of failure (maybe this only happens to non-authors))
JS initial solution and tests are the python ones.
Duplicate: https://www.codewars.com/kata/541af676b589989aed0009e7
Yes, it's 46, my mistake.
Great ;) Great kata btw ;)
The new example test case is added ;)
Loading more items...