Ad
  • Custom User Avatar

    What do m and s even represent?

    past or present denominators, or defaults

    If the value before the most recent left choice was l/m and the value before the most recent right choice was r/s then the new value will be (l+r) / (m+s).

    That line, paraphrased / decoded / whatever:

    (l+r)/(m+s) is each new fraction (next iteration), before substitution and simplification. Let l/m represent whatever the fraction was, just before you most recently parsed an L choice. Let r/s represent whatever the fraction was, just before you most recently parsed an R choice.

    This is how values of l, r, m, s are obtained most often. But l = 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 initial 1/1, corresponding to the empty string, is formed entirely out of them).

    HTH

  • Custom User Avatar

    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.

  • Default User Avatar

    Is the following test case erroneous?

    No the test is correct. You can notice that 5096 guys passed the Java kata.