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.
pity that the tests didn´t cover the edge cases (im spoiled by other katas), e.g. granny having only 1 or no friends, or no address.
My method would fail these tests.
But it wasn't a real life scenario, so meh!
This comment is hidden because it contains spoiler information about the solution
i am not sure of the other solutions, but checking if the granny has any friend or only 1 friend is mandatory!
A great programmer checks for pitfalls, even if they are not covered by tests!
'+ types for input variables
'+ type for return value
This comment is hidden because it contains spoiler information about the solution
const
would be fit here as you don't mutate variables hereI think you meant O(logN), not O(NlogN) as for sort algorithm
This is better than sort algorithm though
And you cannot find a way to get the place where the value is different so it cannot be O(logN)
For me its easier and faster to maintain/understand without regEx.
Thats why i marked it as clever.
Even mathematicians need to code it seems.
clever, but not best practice...not maintainable by me, the least.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Looks like i am the only one that likes to explicitely declare sum as a number.
don´t fear the const.
still thumbs up for best practice.
Mathematician alert.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution