Thanks for informing me, That's certainly not an accurate implementation for passing all possible tests, I applied a different answer considering this problem.
'A tree is hidden if it is shorter than or the same height as a ( any ) tree in front of it, as seen in a particular direction.'
What if there is a list with the following sequence [2, 1, 5, 3, 4, 4, 9, 6, 4, 2, 5, 1, 2]? According to your function, there are 6 trees visible on the left side and 5 on the right side. In this case, your function returns "left". But actually 3 trees are visible on the left side and 4 on the right side. The function should return "right"
Due to the imperfection of the tests, this solution passes, but it should not. Correct me if I'm wrong.
Such a simple regex that I, for some reason, was unable to think of. Props to you!
GOOD!!!!!!!!!
This comment is hidden because it contains spoiler information about the solution
What is this madness
I understand that, but it is always a good practice to remember applying the second argument according to various cases
if you don't pass 0 insted of it will be first elemment of an array, that means you don't need 0
this called sparring, spar to get better
Wtf? Iv started js week ago, but im just simple dont understand which language thats writted by xd
I love this approach, awesome!
Thanks for informing me, That's certainly not an accurate implementation for passing all possible tests, I applied a different answer considering this problem.
'A tree is hidden if it is shorter than or the same height as a ( any ) tree in front of it, as seen in a particular direction.'
What if there is a list with the following sequence [2, 1, 5, 3, 4, 4, 9, 6, 4, 2, 5, 1, 2]? According to your function, there are 6 trees visible on the left side and 5 on the right side. In this case, your function returns "left". But actually 3 trees are visible on the left side and 4 on the right side. The function should return "right"
Due to the imperfection of the tests, this solution passes, but it should not. Correct me if I'm wrong.
clever solution !
This comment is hidden because it contains spoiler information about the solution
same line of thoughts...! completed the code in very list line ...! but, you add 'map' to form array . super bro.!
Can extract the duplicative + '...' from inside the parentheses and place at the end of the falsy execution.
Loading more items...