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.
I'm also a big fan of not using magic numbers. Even in a "simple one-liner".
May I ask why? I'm guessing you'd rather store p0 in a new variable and work with that instead but I'm curious as to your reasoning if the function is only small like this one.
You're removing those numbers from the input, so, when the control function calculates its sum, it's using the other numbers:
136 + 128 + 83 = 347
Anyways, I've changed the tests so the expected value is computed first and your code messing with the input isn't a problem anymore, but be aware of that.Thanks for the reply but I don't understand. The description says, "your task is to find the sum of the minimum values in each row."
As I understand it, the minimum values of each row in the above test are 49, 82 and 17, of which the sum is 148, not 347. What am I missing?
Don't mutate the input.
All of the random tests failed for me. One of the tests tested for [[49, 136],[128,82],[17,83]]. It failed telling me 'Expected 148 to equal 347'. So 49 + 82 + 17 = 347? Or have I grossly misunderstood something?
In bigger projects i would expect such constants. That is much better, than 'magic' 0.5. But if we want just simple function... =)
I notice most solutions I've seen here so far tend not to declare interim variables such as:
const litersPerHour = 0.5;
Wondering what your thoughts are on using them vs omiting them?