Ad
  • Custom User Avatar

    It's normal practise use [].someFn .call()/.apply(). If you like save memory, why you chose JS?

  • Custom User Avatar

    Please help.
    What do tests mean? What arguments do they receive?
    "Single pair of end caps defined - no nesting"
    "Multiple pairs of end caps defined - no nesting"
    "Single pair of end caps defined - with nesting"
    "Multiple pairs of end caps defined - with nesting"
    "Multiple open and close caps are same character - with nesting"

    Balanced and unbalanced case. I wrote a function that works perfectly and I can't break my function.

  • Custom User Avatar

    When you create kata please write description's tests smarter.

    I can't understand next:
    Time: 323ms Passed: 33 Failed: 8
    Single pair of end caps defined - no nesting
    Balanced
    ✘ Expected: true, instead got: false

    Single pair of end caps defined - with nesting
    Balanced
    ✘ Expected: true, instead got: false
    ✘ Expected: true, instead got: false
    ✘ Expected: true, instead got: false

    Multiple pairs of end caps defined - with nesting
    Balanced
    ✘ Expected: true, instead got: false
    ✘ Expected: true, instead got: false

    Multiple pairs of end caps defined - no nesting
    Balanced
    ✔ Test Passed: Value == true
    ✘ Expected: true, instead got: false

    Multiple open and close caps are same character - with nesting
    Balanced
    ✘ Expected: true, instead got: false

    For people who speak English a little hard translate this description. If I see what function receive and what tests want in output I guess how function must work.

  • Custom User Avatar

    Sorry for incorrect mark. Nice kata. Be stronger in algorithms.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar
  • Custom User Avatar

    Yes. You're right. Why n(1) => 81; n(2) => 512 etc. What does function return when n is 5?

  • Custom User Avatar

    I can't understand what does function receive? Tell more for dummies

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    JS:
    Passed: 199 Failed: 6
    Basic tests are passed. How can I guess why random test are failed? If I get next answers:
    Testing fortune:
    ✘ Expected: true, instead got: false

  • Custom User Avatar

    JS:

    ✔ Test Passed: Value == [-2,-1,3]
    ✘ Expected: [[-3,-2,5],[-3,-1,4],[-3,1,2],[-2,-1,3]], instead got: [[-3,1,2],[-2,-1,3],[-3,-1,4],[-3,-2,5]]
    ✘ Expected: [[-3,-2,5],[-3,-1,4],[-3,1,2],[-2,-1,3]], instead got: [[-3,1,2],[-2,-1,3],[-3,-1,4],[-3,-2,5]]
    ✔ Test Passed: Value == No combinations
    ✔ Test Passed: Value == No elements to combine

    What's wrong in my case? What order does compiler want?

  • Custom User Avatar

    JS version:

    arr = [1, -1, 2, 3, -2, 4, 5, -3, -3, -1, 2, 1, 4, 5, -3 ]
    n = 3
    find_zero_sum_groups(arr, n) == [[-3, -2, 5], [-3, -1, 4], [-3, 1, 2], [-2, -1, 3]]

    P.S. In this case what about combinations [-2,1,1] and [-1,-1,2]? They must be in array, isn't it?