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.
When your first solution fails, check the examples for clues as to how the actual problem works. I had to toss this one into a spreadsheet to get a clear idea of how it actually worked. This is no different than every programming project ever.
This comment is hidden because it contains spoiler information about the solution
OP solved it, closing
This comment is hidden because it contains spoiler information about the solution
the
(a, b), (c, d)
of "on the one hand..." are not necessarily the same as the previousa, b, c, d
that are used to formn
; they are a permutation of it, e.g.b, a, d, c
Timing out is not a kata issue.
No worries, Racket is quite unusual in that regard.
The number
58430
isexact
and therefore rational, and the number58430.0
isinexact
which does not guarantee rationality; these are not the same number.58430.0
could represent some number which is not precisely58430
, differing by some small epsilon. Because you are instructed to return an integer and all integers are rational, you should return the rational (exact
) representation.In strict terms it is only a coincidence of the underlying encoding that the
inexact
representation of this number holds precisely the same value as the intendedexact
representation. There are (rare, quirky) situations where assumptions like this could bite us in the arse.Sorry there are no errors in the tests. Good luck!