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.
What is this? Windows start on 2nd floor. So in the example below, we have 0 floors and 1 window, meaning we need to increase the amount of floors by 2.
Can we rely on
Environment.NewLine
? Shouldn't we specify\n
or\r\n
in the description and in code?A trailing newline is expected but was not mentioned at all.
Every random test expects the same 20 floor house with 20 windows and a door.
This comment is hidden because it contains spoiler information about the solution
This seems to be a problem with codewars at the moment, as every Kata I try has this problem currently.
When I'm doing the test, I systematically get an "Unauthorized" message.
I'm new, and I don't understand why?
This comment is hidden because it contains spoiler information about the solution
You are right. Here are benchmark results
Counting elements in a collection is a duplicate.
This is incredibly slow, as Enumerable.Range needs to generate every number in every range you feed it.
Maybe ensure that the elements in
notes
are in descending order. Something like|> List.sortDescending
in the assignment should convey that the elements cannot be in random order.This code is not f# idiomatic. I recommend reading fsharpforfunandprofit. It is a great read and improved improved my functional programming tremendously.
https://fsharpforfunandprofit.com/posts/thinking-functionally-intro/
I upvoted this solution for being clever, but it would almost certainly fail with very large intervals.
For example consider:
(0, int.MaxValue)
. The length of this example interval is over 2.1 billion -- LINQ uses an in-memorySet<int>
to track the 2+ billion unique integers coming out ofDistinct()
, followed up by the counting of 2+ billion unique integers -- either a timeout or OutOfMemoryException seems likely.MS Reference Source for Distinct()/DistinctIterator(), see also: source for Enumerable.cs on GitHub; search for Distinct
The current "random" test isn't random at all, it's just enumerating the input range of
([50-60],[50-60])
.Loading more items...