Skip to content

Commit

Permalink
300th?? Exercise?!
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesCreativeContent authored Oct 3, 2022
1 parent afd3f30 commit 2ccff51
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions 7th Kyu/digitsExplosion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
Given a string made of digits [0-9], return a string where each digit is repeated a number of times equals to its value.
Examples
explode("312")
should return :
"333122"
explode("102269")
should return :
"12222666666999999999"
*/


// Answer //
explode = s => [...s].map(num=>num.repeat(+num)).join('')

0 comments on commit 2ccff51

Please sign in to comment.