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.
While using reduce looks cool, it is better to use simple for loop wherre you can stop once you found the first marker
its seems simple and readable
could anyone explain why my solution works slower than this one? It looks like it's not supposed to be so, but I can't find out why it is
Terrible decision, so here the time complexity is O (3nm2k), when you can do it in O (2n), I don’t understand why someone liked this decision
the details for assignment was to trim the trailing end. you trimmed the leading and trailing end. this would mess up and lines of text that started with spaces
why the [0] here? Can someone explain?
Smart solution! Thanks
I like the terseness of this solution but it does not cover the case where a comment marker is included within a string literal in the code, like
"console.log('this is a js comment: //') // real comment"
Instead, this solution will return:
"console.log('this is a js comment:"
This isn't a requirement for this problem so maybe I'm being pedantic, but it's a good thing to consider for this type of parsing. Either way, nice solution.
replace works a little slower
Why
👍