Ad
  • Custom User Avatar

    Also note that this optimisation depends on O(1) access from right to left ( or just plain O(1) random access ).

    The Haskell version uses cons-lists, so no cheap right-to-left access. Other non-esoteric languages probably all have it though.

    LC requires exporting snoc as cons for this to work.

  • Custom User Avatar

    There is the eternal tension between performance and simplicity, readability and maintainability, in the light of the ranking of the kata.

    I tried once, for a too short while, to achieve what you did, but didn't think it through enough and gave up too quickly; I never got there. Kudos for your solution.

    But being disappointed in less performant but correct and readable solutions to a 7kyu kata seems setting yourself up for a lot of disappointment. :P