Ad
  • Custom User Avatar
  • Custom User Avatar

    It is indeed somewhat inefficient and potentially return an error, given p0 = 100, percent = 2, aug = 10, p = 100 (I know, evil)
    it would return 1 year, while the correct answer would be 0.
    To solve it, initialize years = 0, get rid of the initial pCalc (that already assumes it year 1), and place it all inside the loop :)

  • Custom User Avatar

    why do you feel its inefficient?

  • Custom User Avatar

    Thx g964, this was the missing piece of info for me. Next time I'll start with reading the discussions tab.

  • Custom User Avatar

    The tests are the same in all languages. 1840 guys passed the kata (236 in C#). I am afraid you didn't read the description.

    As another guy said below (you could have read that):

    For every possibility/combination of strings in each array, computes the following:
    abs(length(x) − length(y)), where x belongs to array1 and y belongs to $array2
    Finally, returns the largest/maximum value found.

    Good luck and happy coding!

  • Custom User Avatar

    This kata is (at least in c#) useless. The random untittests are not consistent in their expectations. For example, given these lists (only string length shown), it expects to 7 as the answer while 11-2=9 is the max lenght difference. Anyone can explain the purpose?

    a1: 2, 4, 5, 7, 7, 9, 11
    a2: 6, 8, 8, 9, 9