The wave (known as the Mexican wave in the English-speaking world outside North America) is an example of metachronal rhythm typically achieved in ...
For further actions, you may consider blocking this person and/or reporting abuse
Got it to one line of js :)
It's a bit unreadable but... you know ๐คฃ
Without use slice
oh, haha - nice!
In my quest for a single line function, I missed the part about skipping the character if it's whitespace... so here's that tacked on too (though I added the filter to the end in order to keep the whole thing to one line) :)
Always amazes me when people get it into one line. ๐
map,filter, andreduceare your friend! Whenever I'm dealing with translating one string, array, or object into another one, there's probably a way to do it by just chaining those three methods together.CSS
This is not exactly what is requested in the challenge, but close (at least for CSS). The letters need to be wrapped on their own span, and then add "wave" to the parent element. An animation is added that transform one letter at a time into uppercase (not exactly an array, sorry, and it heavily depends on length):
Here is a demo (with some other animations too):
CSS solution is amazing :D
c++
That's crazy.
from where did you learn that u should use 32 , i didn't know that before
Thank you
In Rust, although there is almost certainly a more efficient way of doing this.
Playground link here.
You can use concatenation to avoid a character by character copy.
I don't know the first thing about Rust, so this is probably not optimal either.
Playgrund link here
Nice!
Funny thing. The other day I was creating a wave animation using text in CSS. It used font-weights instead of case change, but updating it to adapt to this challenge should be fairly easy. Although it wouldn't return an array, but generate an animation instead.
Rust, with iterators:
Rust "one-liner" Playground
A little JS impl using a regex and
matchAll(avail in recent browsers):Output:
My python sol :
In one line with a generator and a lambda function :
Love it
As an Elixir function, including documentation! And a language feature I'm writing about in
an upcoming postUPDATE: the post is up!! ๐JavaScript
Playground
Play with it on Repl.it.
expect(received).toEqual(expected) // deep equality
Python
One long, ugly line of haskell. (I guess 2 including the import)
Edit: missed note about skipping whitespace. Will fix it soon
Go:
Play with it here.
JAVA
In ruby
Nice, I have been having issues with repl loading up.
Not the website or even an repl page just the code within it,
getting that dreaded:
Failed to connect, retryingmessage.Then after about 5 minutes it loading, have you been having similar?
(sorry for being a pain)
Sorry I haven't had that kind of issue. It's ok
Nice! The runtime complexity is pretty substantial, but it's a really good first pass on the problem ๐
ruby <3
C#
var wave = str.Select((c, i)=> str.Substring(0, i) + str.Substring(i, 1).ToUpper() + str.Substring(i+1, str.Length-i-1)).Where(s => !s.All(c => c.ToString() == c.ToString().ToLower()));