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.
Something ain't right when 2 comes before n haha.
Nice practice.
Exactly as Jotha said, that was my reasoning. Return does the same as break here.
Because a
return
is technically abreak
, except it breaks the whole function.The ol' reliable baby!
first you get dry content, which is constant(w0 * (100 - p0)), then we convert back to full weight by using reversal operation with new percentage
Can someone explain please? I'd really appreciate it.
nice!
Checking for sum of [1,2,...n] is NOT enough for a perfect solution,
eg. your program gives True for
{ 5,5,5 5,5,5 5,5,5 }
{ 5,5,5 5,5,5 5,5,5 }
{ 5,5,5 5,5,5 5,5,5 }
{ 5,5,5 5,5,5 5,5,5 }
{ 5,5,5 5,5,5 5,5,5 }
{ 5,5,5 5,5,5 5,5,5 }
{ 5,5,5 5,5,5 5,5,5 }
{ 5,5,5 5,5,5 5,5,5 }
{ 5,5,5 5,5,5 5,5,5 }
which obviously is an invalid sudoku of 1,2,...,9
(but it does have sum of 45 in every row, column, and small square)
You have to make statistics of the occurred elements too to determine if the solution is valid.
The fastest way i know of.
nice
Jotha gave you the best explanation. Also check on Mozila website for javascript documentation ;)
A
break
only exits theswitch-case
statement. On the other side areturn
exits the whole method, so this is valid, too. As you can see, in any case there will be a returned value.Why didn't you type 'break' in each case? Is it not necessary?
RLY, Codewars... I see 1 message, I think I forgot to submit my message yesterday and submit it again. Then I see all yesterdays's messages and my new one. Then I refresh the page and now see only 1 message again.
Loading more items...