Ad
  • Custom User Avatar

    A best practice when templating this kind of algorithm is to
    make it generic, i.e. pass a range or [begin,end) as template parameters...
    Indeed, the initial parameter says 'iterable' :-)
    May also test with any kind of ordered iterable, so that one may use concepts one day and return {} if the values cannot be ordered ?

  • Custom User Avatar

    s = 'AAAABBBCCDAABBB'
    s = 'AAAABBBCCDAABBB1254888744'
    s = ['AA', 'A', '', '','B','B','C','c','b', '', 'None',5,5,'5']
    s = ['i', 't', 'e', 'r', 'a', 'b', 'l', 'e']
    s = ['A', 'B', 'C', 'D', 'A', 'A', 'D']
    s = ['A', 'A', None, None, None]
    s = ['5', 5]

    i run all above TCs in local env, and all producing the required result

    but when i run here, it failed with the below error
    expected undefined to deeply equal [ 'A', 'B', 'C', 'D', 'A', 'B' ]

  • Default User Avatar

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

  • Custom User Avatar

    Thanks bro, finally it works for all 21 TCs. i completely missed that part to output the sum of all cubics.

  • Custom User Avatar

    Read the description again:

    The task is to find, or not, the "cubic" numbers in the string and then to make the sum of these "cubic" numbers found in the string, if any, and to return a string such as:

    "number1 number2 (and so on if necessary) sumOfCubicNumbers Lucky"

    The second 0 is sumOfCubicNumbers

    You can easily see that in the example:

     - s = "aqdf&0#1xyz!22[153(777.777" 
       the groups of at most 3 digits are 0 and 1 (one digit), 22 (two digits), 153, 777, 777 (3 digits)
       Only 0, 1, 153 are cubic and their sum is 154
       Return: "0 1 153 154 Lucky"
    

    154 is not in the string, it's the sum of 0 + 1 + 153

  • Custom User Avatar

    where the second zero came from ?! we extracted 1 | 3 digits numbers, then sum of the cubic of each number digit 0 737 244 125 863
    like that : 153 is such a "cubic" number: 1 ^ 3 + 5 ^ 3 + 3 ^ 3 = 153

  • Custom User Avatar

    Read the post below, it's explained why the answer to that is "0 0 Lucky" One is the hidden cubic number, the second zero is the sum of all cubic numbers.

  • Custom User Avatar

    the packets with at most 3 digits in this string 0 9026315 -827&()
    is 0 902 631 5 827 Who agree with me ?

    Cal the cubic of each digit and sum up all 0 737 244 125 863
    Then check sum only '0 Lucky'

    i beleive something wrong with test case
    please all help, it is nice kata but tooks me a while to figure it out :) .

  • Custom User Avatar

    the packets with at most 3 digits in this string 0 9026315 -827&()
    is 0 902 631 5 827 Who agree with me ?

    Cal the cubic of each digit and sum up all 0 737 244 125 863
    Then check sum only '0 Lucky'

    i beleive something wrong with test case
    please all help, it is nice kata but tooks me a while to figure it out :) .

  • Custom User Avatar

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

  • Custom User Avatar

    Do u mind to check out my solution , and how it passed the TCs ?!
    Thanks

  • Custom User Avatar

    Just wanted to highlight that ,
    i really like ur katas, am learnign new things everytime
    keep rocking dude -;)

  • Custom User Avatar

    I'm very positive this would have been created WELL before that one?

  • Custom User Avatar

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

  • Custom User Avatar
  • Loading more items...