Follow

okay, this is not exactly a but I hope you hate this problem as much as I did...

The problem is not just getting the right solution, but getting it in under the running timeout of 12000 ms. Good luck.

codewars.com/kata/54d81488b981

@Absinthe getting it under 12 seconds if the list is small is trivial, doing it on large enough lists might get tricky but to make the challenge useful youd have to specify the list of numbers that must be worked in under 12 seconds.

Obviously this also assume we all do the task on relatively similarly powered computers.

@freemo They don't tell you that you have to do it in any particular time or space. It is a bad challenge form that part. When you start there are a few tests that you run. Then when you think you are happy and submit it, it runs against more tests. Some of them are over a million long with the numbers being at the beginning and end, and also in the middle. I did put a link in for the actual problem. It has a ui and a working compiling and testing environment. I had the logic solved dead on, but couldn't be certain until I got it efficient enough to go through the big blind tests without timing out. You get very little feedback on a timeout :)

@Absinthe Yea not knowing how to optimize in this case is just not enough info IMO

@freemo would it help to know that the solution is based on memoization ?

@Absinthe Oh I already speculated a solution (and a few other tweaks). Just too bust to try it out. In the middle of writing a specification and trying to learn bikeshed at the same time

@Absinthe Im similarly confused by the wording.. in the following example whats the answer:

[1,2,5,8,9,10,11,12,13,6] sum: 7

I guess 1,6 it only counts the left most?

@freemo It was a weird challenge.

Here is the odd part:

[5,3,8,7,8,9,5], 10 would be [3,7]

Because it finished first. Even though [5,5] starts first.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.