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.
yup, still can't make sense of it after understanding the solutions.
past or present denominators, or defaults
That line, paraphrased / decoded / whatever:
(l+r)/(m+s)
is each new fraction (next iteration), before substitution and simplification. Letl/m
represent whatever the fraction was, just before you most recently parsed anL
choice. Letr/s
represent whatever the fraction was, just before you most recently parsed anR
choice.This is how values of
l, r, m, s
are obtained most often. Butl = 1, r = 0, m = 0, s = 1
are defaults, used when there is no previously parsed L or R (or neither, as shown in the way that the initial1/1
, corresponding to the empty string, is formed entirely out of them).HTH
Same here, I took my notebook and wrote the numbers, the fractions, tried to find a pattern but nothing. I'm not quite following the explanation, this is a problem that most likely would be solved in lets say 10-15 lines maybe, but man I can't even find the logic. If someone can explain it I would appreciate it a lot.
javascript translation added and made description language-agnostic
approved some while ago
Clever, but this code is less readable than if you split it into several functions with explicit names.
this image should really be in the description
Yesn't,
Char
is an instance ofOrd
where the characters are ordered by their unicode codepoint. It does not really "threat them as they were numbers" but deep down at some point everything is an int eventually.wait, Haskell treats chars the same way as if they were numbers? like, he automatically converts char to number like ord() in python?
python new test framework is required. updated in this fork
And now I know about the sorted() function...I love it.
This comment is hidden because it contains spoiler information about the solution
nice, never knew this concept.
So interesting solution
nice code, clean :)
Loading more items...