• Custom User Avatar

    Maybe because some programmers are programmed to program programmatically... rather than to think ;)

  • Custom User Avatar

    such problems don't score well on CW :(

  • Custom User Avatar

    @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.

  • Custom User Avatar

    I`m looking at this task 15 minutes and cant understand what is a process(((

  • Custom User Avatar

    This is more like a thinking problem than solving problem.

  • Custom User Avatar

    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

  • Custom User Avatar

    Yes, you right. I didn't find anything when I searched for something similar.

  • Custom User Avatar

    I removed JS.

  • Custom User Avatar

    (there is a bug about the very first publication of a kata, where some checks are lacking, hence the dummy translation can exist)

  • Custom User Avatar

    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))

  • Custom User Avatar

    JS initial solution and tests are the python ones.

  • Custom User Avatar
  • Custom User Avatar

    Yes, it's 46, my mistake.

  • Custom User Avatar

    Great ;) Great kata btw ;)

  • Custom User Avatar

    The new example test case is added ;)

  • Loading more items...