Ad
  • Default User Avatar

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

  • Default User Avatar

    i agree, reading correct helps a lot here.
    even with the 1200ms timeout problem

  • Default User Avatar

    Usually I think codewarriors add what is needed and lots of guys passed the kata as it was and nobody complained.
    I just added "#include cmath". Thanks!

  • Default User Avatar

    C++ sample test is broken. Throws errors.
    For example:

    class ArcParabLen
    {
    public:
      static double lenCurve(int n) {
        return 0.0;
      }
    };
    

    results in

    -isystem /runner/frameworks/cpp/  error: call to 'abs' is ambiguous
        bool inrange = std::abs(act - exp) <= 1e-6;
                       ^~~~~~~~
    /usr/include/stdlib.h:775:12: note: candidate function
    extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
               ^
    /usr/include/c++/v1/cstdlib:159:44: note: candidate function
    inline _LIBCPP_INLINE_VISIBILITY long      abs(     long __x) _NOEXCEPT {return  labs(__x);}
                                               ^
    /usr/include/c++/v1/cstdlib:161:44: note: candidate function
    inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
    

    Did you forget to #include <cmath>?

  • Default User Avatar

    I just added "#include cmath".

  • Default User Avatar

    C++ sample test is broken. Throws errors.

  • Custom User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

    195 guys passed the kata out of 1415. I'm very sorry for you.

  • Default User Avatar

    C++ solution isnt working. Keeps throwing errors. Cannot solve this. Terrible question description as well. Downvoting.

  • Custom User Avatar

    The description of this kata tries to speak for all its language versions (currently C++, C#, and JavaScript). Please read "array" as "indexable data structure", i.e. std::vector in C++, array in C#, Array in JavaScript.
    Regarding your second point: We are really working with sorted arrays (std::vectors in C++). Look at the test cases.

  • Default User Avatar

    The name of this kata should be changed. While vectors represent arrays, we're not working with sorted arrays. Nor are we even working with sorted vectors. The question contains arbitrary size vectors with arbitrary number distribution. This should be clarified via the title and description. It also helps users create a focused solution since they dont have to interpret the definition of the kata.

  • Default User Avatar

    Maybe the problem is not the performances of the loop/code, but an edge case the provoke an infinite loop...

    ("Edge cases"... g964 play A LOT with those...)

  • Default User Avatar

    Exactly this same. My code runs 0.016 seconds for 20000+ bounces in my shell, anyone having any ideas?

    I use the while loop in which I multiply height by bounce.
    while height > window:

  • Default User Avatar

    There's a small hint in the kata about how you determine the count. Read carefully and understand. I didnt understand why my code wasnt correct and i reread and the light bulb turned on.

  • Loading more items...