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.
OP solved it, closing
Not a kata issue. Also, your code should return the array of original unmodified string instead of the change-cased one in which you use for comparison with values in dictionary.
Your latest solution did not finish the LCM computation for all pre-processed sum values (check your
for
loop's condition)Your code fails for cases like
n = 225
because it is divisible by9
, resulting in25
. However, there is no decimal point in25
, sop
now becomes [25
] (an array of string) due to splitting. Trying to access a non-existent index (1
) results inundefined
, and trying to accessundefined[0]
results in the Error.This comment is hidden because it contains spoiler information about the solution
The user's already solved the kata.
Not an issue.
Not an issue.
You'd have a whole other problem if your list is empty other than reduce here using strictly list.length as the denominator.
There are also non-integers.
Object.values
doesn't exist in CW's Node 6 version (it's a ES7 thing).This is a riddle. The whole point is that you're supposed to figure out what the riddle is by investigating different things.
No, exactly
k
moves is right. ;-)It means such a sitution:
Some robot after 3 moves back to the starting point, after 6 moves it back to the starting point again. and so on.
This robot should NOT be counted when
k=6
ork=9
ork=12
...It's using regular expression magic to do the trick:
First, it looks for any characters that aren't newlines (
\n
), and duplicate them k times. This effectively does this:abcdef ==> aaabbbcccdddeeefff //assuming k=3
Then it looks for a whole chunk of characters between newlines, and duplicate this chunk n times, inserting new lines inbetween:
Loading more items...