Ad
  • Default User Avatar

    I agree, the types used in a kata should not depend on one particular compiler implementation. In particular, if you need an integer type that must hold values larger than what fits in 32 bit, it would be better to use one of the fixed-width integer types from cstdint, e.g. int64_t.

  • Default User Avatar

    You are probably solving on 64-bit Windows where long is 32-bit. Codewars runs on 64-bit Linux where long is 64-bit. As a quickfix, you can use long long in your solution. But I agree, this is an issue, C/C++ code on Codewars should never use long as it makes the user experience worse for Windows users.

  • Default User Avatar

    in c++ input parameter has type long, but 10e10 numbers can't fit into long, maybe change to long long?

  • Default User Avatar
    1. 22595200368 != 6540715897. The kata asks for strict equality, not merely enough possible combinatons.
    2. Yes, I agree that x=0 for any m=1 doesn't make much sense for the real-world scenario described. However, if there should be another answer, 1 is clearly wrong (once again, it asks for equality), so then the correct value of x would be x=n
  • Default User Avatar

    There are multiple errors with test cases in c++:

    1. m=6540715897, n=48. Test is expecting -1, while the real answer is 11
    2. m=1 n=11 and any others where m<n, where test is expecting 0. While mathematically correct, 11 choose 0 = 1, the answer should be 1, as you cant paint with 0 colors