Ad
  • Custom User Avatar

    A couple notes here.

    Number one, the naive way is MUCH more correct than this one. Most would just count left and right parens, and build the string with it. I choose to view this as a combinatorical problem with trees, and wound up not being able to finish it in time (mostly).

    Number two, randomized tests are simply bad design. By resubmitting over and over, I was able to avoid the two numbers (9 and 10) which would choke this admittedly over-complicated piece of code. It's probably better, especially with problems that (at least CAN) scale exponentially, to have a static set of test cases. Even more so when the max input it ever sees is 10.

    Third, while it's slow, inefficient, complex, and nearly impossible to read, this is one of my favorite pieces of code I've ever written.

    Thanks!

  • Custom User Avatar

    It's matter of definition, and this kata defines fib 0 as 0. As long as it's defined unambiguously, it's not a problem.

    To me, fib 0 = 0 makes more sense than fib 0 = 1, because negative inputs work better ( more symmetrically ).

  • Custom User Avatar