Ad
  • Custom User Avatar

    I think it's not a bug rather than lack of proper documentation. (updated)
    But thanks for asking! :)

  • Custom User Avatar

    The original rules of calculating quipu is what I mentioned above. (I will update the description instead of the tests)
    Do you mind to change it according to that?

  • Custom User Avatar

    @bejczib,
    Do you need me to change my JS translation? (it contains random testcases)
    Or, let it be as an independent version? (different rules)

  • Custom User Avatar

    @peterwang1996,
    兄弟,这不能怪我啊,原作者这哥们没有提供随机测试,只有几个固定测试,所以关于连续的~的规则是我猜测的。
    如果你是在尝试JS版本,请按照我的规则做吧,如果是Ruby, 请随意;-)

  • Custom User Avatar

    yes, @myjinxin2015, because of the rules mentioned above.
    It has no affect to your solution, because the expected quipu soution is the same. It's just matter of interpretation in the middle of the algorithm.

  • Custom User Avatar

    @bejczib,
    Do you mean @~~~~@ => 1001? Please tell me what's the numbers in this testcase:

    {actual: "@~~~~@+@~@@", expected: "@~~~@~@@@"}
    I think it's 10001+12=10013
    As your mean, it should be 1001+12=1013? OMG..
    
  • Custom User Avatar

    It is an interesting one! I have to say that myjinxin2015's answer ins't right..
    When I found out the kata I didin't thought about corner cases like this.. :)

    So the correct solution would be like this:
    ~ -> 0 or space

    between two 0-s you have to put a space but between a 0 and 1 for example you haven't.

    @~@ => 11
    @~~@ => 101
    @~~~@ => 1001
    @ ~     ~ ~     ~ @ => 1001 (!!)
    1 space 0 space 0 1
    

    I will add more test to validate this solution. :)

  • Custom User Avatar

    @~~~~@@ === 10002

    @   ~   ~~~ @@
    1 space 000  2