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.
bro memoization is an overkill here remeber that passwords have an average maximum of 16 digits and a O(N^2) algorithm could do it in 256 cycles which is very low
That's true, but the question also doesn't make sense for float values. How do you fill the output array with 2.3 input arrays?
This code fails for float values. And in the Instruction, it wasn't written that the numbers can only be int.
thats crazy and amazing
nice
I like that this solution goes for a very direct interpretation of the task. Using filter keeps the intent easy to follow, and the check based on the word length is simple enough that it reads naturally without extra variables.
One thing I appreciated is that it avoids unnecessary transformations — the function just keeps the words that match the condition and returns them as-is. That makes the behavior predictable and easy to reason about when scanning the code.
It also feels like the kind of approach you arrive at after thinking a bit about what “even length” really means rather than just pattern‑matching a common solution, which is always nice to see. Overall it's a small piece of code, but it stays focused and does exactly what it needs to without extra noise.
calm down bro
Oh, Applied a lookup-table pattern for constant-time state transition without branching logic. That's great.
thank you for sharing your thoughts. learning by building from scratch is a solid habit.
it's clear that your goal is to learn from first principles. others, optimize for speed or clarity (or showing library knowledge), so using imports is a valid choice.
I understand that not everyone thinks like me, but what I would like to point out is that a lot of the time, using an import is substantially slower than just writing your own function. Not only that, you get to learn something new and think through the problem through "first principles". Personally whenever I write software I try to rely on external libraries as little as possible, mostly because I like to treat it as a learning exercise and I would encourage others to do the same.
We're here to enjoy the process of solving problems on this platform, regardless of our methods.
That statement about having to write every algorithm from scratch isn't accurate.
Although it's been mentioned that this is not a best practice solution, I would like to point out that using imports to solve every problem defeats the purpose of this site. We are supposed to practice writing our own algorithms from scratch.
Nice! Had to dig into floating point numbers passed into Array.slice(). It seems to truncate, not round. Very cool solution!
This short solution looks neat but can break on UTF-8 characters, because
[..1]slices bytes, not Unicode scalar values.Examples:
"Привет"will panic.Using [..1] on these will panic, because it slices bytes, not Unicode scalar values.
but this doesn't work for input array [2,2,3,3] or [2,2,2,3,4,5]. Am I missing something?
Loading more items...