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.
They don't ignore the result. The result (aka the accumulator) is the "prev" element.
I thought your use of reduce for this was pretty clever :)
So succinct! Very nice!
You taught me something new about Python! Thanks!
This comment is hidden because it contains spoiler information about the solution
A simple, clean, "brute force" approach. This solution will run in O(n) time. FYI you can make an optimization to run this is much less time.
One other minor suggestion -- there is no need to declare the type in
let counter: number = 0;
. Typescript will infer the type as number from assigning the value0
to the variable and it's typically considered best practice not to over specify types where they can be inferred.Description says all input will be lowercase but the supplied test case includes uppercase.
This comment is hidden because it contains spoiler information about the solution