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.
i don't get why mine doesn't work, it seems like it's identical to your code, please tell me what's the difference between them and what's wrong with my code >_<
This comment is hidden because it contains spoiler information about the solution
Done.
Please fix the grammar in the description. Instead of "Remove a exclamation...", it should be "Remove an exclamation...".
:D
Then someone would invent the floatiest floaty zero ever.
This comment is hidden because it contains spoiler information about the solution
My solution started out like this as well, but I used !== and ===, which failed the tests.
This comment is hidden because it contains spoiler information about the solution
I wish I had thought of preg_replace.
I think the
i
ands
modifiers are not necessary.Thank you for the constructive feedback! I've had some struggles deciding how best to handle return points in conditional-based functions, reframing it as "what output do I want?" makes a lot of sense.
This comment is hidden because it contains spoiler information about the solution
I can at least say that user-input regex is not for prod on account of they can be used for denial of service attacks, though Python's regex engine seems to be capable of running system interrupts if a regular expression is taking too long (the use of goto statements makes this very hard to analyze). I'm not so sure about Javascript being able to be interrupted so that'd be something to look into if you're thinking user-defined regex.
The criticisms here aren't about using regular expressions, but how long the regular expression takes to execute compared to an alternative solution that doesn't use regular expressions, so it's always going to be slower than that particular alternative solution, but the inherent increase in slowness is limited by the data it's being applied too. So if you're running it on very large strings or a lot of strings it's going to be much slower (O(n^2)) as the string size increases, but if the amount of data you're applying it to is small/infrequent, the increased slowness is negligible.
So from the time complexity side of things, the faster solution is better. And computer science programmers are usually taught about time complexity, though there's also another dimension called space complexity that often gets overlooked which this solution performs better on than the faster solution (uses fewer system memory resources).
And from the practical application side of things, it suffices in certain but not all contexts because you've obviously got trade offs on what resources are available (processing time available vs. space available in system memory).
just for understanding,
regex is not for prod,
or greedy regex is not for prod,
or it depends,
or if don't know/sure, then don't use regex on prod?
Could you elaborate on how this could be improved? (Or I'm missing the point of your feedback)
Loading more items...