in .reduce((a,c)=> ... ? c : a) the a is our current best choice. The c is the next one we are checking. We make a comparison (in ...) and if c is a better choice, we return that, otherwise we return a. Whichever one we return, will become a in the next comparison. When there is nothing left to compare, a is returned (the best choice from all).
in
.reduce((a,c)=> ... ? c : a)
thea
is our current best choice. Thec
is the next one we are checking. We make a comparison (in...
) and ifc
is a better choice, we return that, otherwise we returna
. Whichever one we return, will becomea
in the next comparison. When there is nothing left to compare,a
is returned (the best choice from all).https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/in
If
v in seen
thenfalse
and that means, filter thev
from the array.When reporting a problem, please state the language you're talking about, not all languages have the same tests.