The right hand side of the || is only evaluated if the left hand side is zero (a falsy value). So the sorting prioritizes count (objects with higher count come first), and when both counts are equal, the next condition is used (alphabetical sorting, by src and then by char).
The code in the rightmost brackets gets executed first, converting the input string to uppercase.
Then, this value is passed into the leftmost pair of brackets (through the use of an es6 arrow function), and compared against the reversed string.
Your function isn't returning anything, so that's the same as returning undefined that is a falsy value, you'll only pass the tests that expect false that way.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
The right hand side of the
||
is only evaluated if the left hand side is zero (a falsy value). So the sorting prioritizescount
(objects with higher count come first), and when bothcount
s are equal, the next condition is used (alphabetical sorting, bysrc
and then bychar
).The code in the rightmost brackets gets executed first, converting the input string to uppercase.
Then, this value is passed into the leftmost pair of brackets (through the use of an es6 arrow function), and compared against the reversed string.
Please don't spoil solutions.
This comment is hidden because it contains spoiler information about the solution
Your function isn't returning anything, so that's the same as returning
undefined
that is a falsy value, you'll only pass the tests that expectfalse
that way.The tests are fine:
Post your code as instructed here: https://docs.codewars.com/training/troubleshooting/#post-discourse
You must be reading the logs wrong, the first one expects
true
and the otherfalse
.My whole doubt is about how to find n. What kind of formula do I should use?
How are we suppose to know each block takes how many height. The test only give us the so called height, m
"It works" doesn't mean it is correct.
ball_type
is not supposed to be a method, not an issue.Thanks ))