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.
Big O notation is used to discuss how things grow as the dataset gets larger. It is not strictly limited to runtime, and is never in fact measuring runtime. It is simply a way of mathematically approximating how things grow.
It can be used to talk about the number of operations performed, number of comparisons used, memory required, memory allocations, etc. Its all in how you slice the code and determine what the most costly factors are. Whatever is most costly will generally have the biggest impact on runtime/performance.
In this case, memory allocations are the most costly part of the algorithm. And making 1 allocation, versus 3N + 1 allocations is the part that effects both the runtime and memory usage the most.
@FArekkusu where can we find out why it was retired?
Doing this math in milliseconds is a super bad idea, and completely unnecessary.
You could have used lodash's range() method generate the months array and turn this into a one liner.
Pretty efficient except for one line:
new Date(String(year))
This would be more efficient as:
new Date(year, 0)
Mixing let and var is not "best practice".
This comment is hidden because it contains spoiler information about the solution
Split/Join is significantly less efficient than replace.
Always use curly braces on if statements for readability and maintainability.
toCharArray() creates a copy of the string. You should always avoid this method.
Do not use toCharArray(), it causes the string to be copied, where a copy is not necessary.
This comment is hidden because it contains spoiler information about the solution
Doesn't work for all test cases.
Needs a test case where some words are a substring of previous words.
Example: "starborn star"
Fails for case "starborn star"
Loading more items...