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.
same with me.
excelente!
This comment is hidden because it contains spoiler information about the solution
This is the way, learn to use template literals, they are very helpful and easy to read.
Great solution! Many other solutions seem to return
-0
but not this one.Maybe you are not using the backtick for your string or the string is not exactly the same as the example in the instructions.
You are correct. I was using " and ' instead of `. At the time, I did not know the difference. I've been learning a lot since then.
Your string needs to be between back-ticks, the ones situates on the left side of the keyboard. These: ``, not these ''
Wait! Why didn't I think of this? 😅
I realized that I had been using a single qoutation mark('') instead of the un-shifted tilde key(
.
) for these statements and was getting constant errors because of it. Hope this helps others in the future!i left out the semicolon
I ran the exact same thing and got a error:/
same :)
I made it so
The first one takes care of molecules like this: Cl2. What it does is repeat the molecule x times. So Cl2 becomes ClCl.
The second one takes care of molecules with braces with a number after them. E.g. (CCHHHH)2 becomes CCHHHHCCHHHH. The third and fourth do the same but with [] and {} respectively.
The fifth one removes all left over braces as all braces that are left are guaranteed to have no number after them (so no repeating needed anymore).
The sixth one takes each atom and adds a space after it.
Then all the atoms can be split by splitting on a space, after which the reduce counts theatoms.
Its not fast but a funny one liner, though it is not perfect as nested braces don't seem to work (e.g. ((C2H6))2)
Loading more items...