Ad
  • Default User Avatar

    Not a kata issue.

  • Custom User Avatar

    Your solution is wrong and fails with inputs like 8675309 it returns true instead of false.

    8675309 ==> [8, 6*, 7, 5*, 3, 0*, 9] ==> [8, 12, 7, 10, 3, 0, 9] ==> [8, 3, 7, 1, 3, 0, 9]
    [8, 3, 7, 1, 3, 0, 9] ==> [8, 3, 7, 1, 3, 0, 9] = 31
    31 (modulus) 10 ==> 1 , which is not equal to 0, so this is not a valid credit card number
    

    Not a kata issue.

    If a resulting number is greater than 9, replace it with the sum of its own digits (which is the same as subtracting 9 from it)

    You're not doing that right.

  • Default User Avatar

    Can you use a BigInt type or the equivalent?