Ninjas frequently need to signal each other in code. They often employ natural sounds as cover. Our ninja will chirp like a bird, with different amounts of chirps signifying different messages.
chirp(4); //output would be chirp-chirp-chirp-chirp.
Consider String.prototype.repeat,String.prototype.padStart, and String.prototype.padEnd disabled for this challenge, you'll have to think recursively to avoid detection.
Good luck!
This challenge comes from nodesolomon on CodeWars. Thank you to CodeWars, who has licensed redistribution of this challenge under the 2-Clause BSD License!
Want to propose a challenge idea for a future post? Email yo+challenge@dev.to with your suggestions!
Top comments (14)
Javascript
Hot
Small solution in Python 3.X 😄
My first submission at Dev.To! (Excluding the welcome post). I love computer science.
Java
Note that this assumes a few things:
As always, there is no need to use any language but Elixir. We'll establish a signature with a guard clause to make sure the user can only pass a natural number, and a private
chirp_signature to do the work of building the list of chirps, with a default empty list as its second argument. We could useList.duplicate, if the point of this exercise wasn't to make a recursive call 😜Reason
Elm
None recursive javascript solution
`
Haskell:
Also, you never said anything about Haskell standard functions :)
My solution in js
Given some context, which is ninjas talking, I doubt that they can talk negativly or that not talking at all is considered as talking
However, without those information, I fully agree ! 😄