My turned-out-to-be-similar solution:
const paintLetterboxes = (start, end) => Array(1 + end - start) .fill() .map((_, i) => start + i) .flatMap(n => n.toString().split('')) .reduce((a, c) => (a[c] += 1, a), Array(10).fill(0))
First time I actually used flatMap :)
flatMap
-
Btw, IMHO, kata description in a code-box is not the best UX-wise because of additional scrolling...
maybe quotes would fit better?
or separators?
Hey Kostia,
yes, you are right, will search for a better solution, thanks!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
My turned-out-to-be-similar solution:
First time I actually used
flatMap
:)-
Btw, IMHO, kata description in a code-box is not the best UX-wise because of additional scrolling...
or separators?
Hey Kostia,
yes, you are right,
will search for a better solution, thanks!