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.
Lol what? He used sort which is a built in function, also his solution is O(nlogn) when the optimal solution is O(n)
so use the reduce is optimial because O(n) ?
nice try
This is O(n logn). The optimal is O(n).
The description was updated some time ago to reflect this.
I basically created an extra variable for no reason. -______-
Great Job.
This is what I consider clever, not using the built in function.
same
Test with underscores in
word
andnewWord
should be added.In this example:
searchEng('Today is my day.','day.', 2, 'birthday!'); // should return 'No valid input'
how it could be invalid input? in 'Today is my day.' we have 'day.'
Didn't think of that. Good Point! Also like your solution using the spread operator.
Mutating the parameter ... ouch!
A greedy algorithm is an algorithm that tries to take as many of the "most valuable" items from the input as possible.
You are asking the user to take as many of the "3 point" values as they can and then return the remainder in "1 point" items.
noted and fixed - thanks for the input! :D
thanks man, so what is the definition of a greedy solution?
Loading more items...