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.
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?
Hey @petegarvin1!Nice kata Just a small typo. In the kata description, the output string is not as in your tests. For consistency, it should be 'To beat
user
's (and not user) score, I must completex
Beta kata andy
(and not x as the two numbers are not the necessarily the same) 8kyu kata.'. Also, obviously the assumption here is that we are aiming for the least number of katas (hence more beta katas than 8kyu kata). Maybe better to clarify, otherswise you have two unknowns and only one equation, so there isn't a single solution?Loading more items...