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.
This comment is hidden because it contains spoiler information about the solution
This is tricky.
new String
will never be interned if not interned explicitly, because it is, well,new
-ed. So it's always new in the beginning, you will not get an interned instance by callingnew
(it can be interned later, but details are not simple). But. C# has the concept of operator overloading (unlike Java), and it overloads theoperator ==
for many value types, including string. That's whystr1 == str2
performs value equality check, and not a reference equality check.new String("") == ""
will always returntrue
. But. The example you showed does not perform a string equality check. It compares anobject
with astring
, so the overloadedString.operator ==
does not kick in. The comparison is a reference equality check, and, in this case, it will returntrue
only when checking equality of interned string instances.This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
In this kata we have the example:
"var helper = new PaginationHelper(new List{'a', 'b', 'c', 'd', 'e', 'f'}, 4);
helper.PageCount; // should == 2
helper.ItemCount; // should == 6
helper.PageItemCount(0); // should == 4"
But you can't use it like this:
helper.PageCount; // should == 2
helper.ItemCount; // should == 6
Those are props - not a method!
And this kata is stupid. I wrote my code - and pass all 17 test and then pass 63 from 65 when was trying to submit. So - i rewrite it twice - but the same result - 63 tests were good. In my ps i couldn't reproduce any errors - so - i picked up this solution.
This is the first time i use someone's solution - but thit kata is so lame!
I know how to solve it - but they said - that it didn't pass some misterrious tests - i don't even know what kind of tests...
So, i got 63 from 65 =)
With love =)
I like the way you calculated years and so on.
I did the solution with over 40 lines of code and time complexity was still O(N log (n) ), so looking at this solution is embarrasing
Great minds think alike! This is pretty much identical to what I came up with!
Thanks! :)
beautiful code!