Ad
  • Default User Avatar

    the standard term is "Variably Modified types", and yes they are distinct from VLAs, only the VM types will be mandatory in C23, the VLAs are still optional

  • Custom User Avatar

    Is this really called "VLA declaration"? I always thought that "VLA" is used only to refer to stack allocated arrays with runtime decided size.

  • Default User Avatar

    no, your prototype is worse. you use the pointer notation for an array, and you dont make it clear that size is the length of the array. the only thing wrong with the current prototype is that MSVC does not support VLA declarations, but these will be made mandatory in C23

  • Default User Avatar

    You can solve this with pen and paper faster than C. Think first, then code second.

  • Custom User Avatar

    A fast language is not enough to compensate a deficient algorithm. The kata is perfectly fine.

  • Default User Avatar

    Fixed by changing class and method names to FindOccurrence.findNthOccurrence. Thank you!

  • Default User Avatar

    you need to convert to wanted doubles earlier (separate line), then do all the math on doubles.
    then simple int(r) should work

  • Default User Avatar

    Are you sure? You are close, but read the instructions carefully. You are missing something important in the description.

  • Default User Avatar

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

  • Custom User Avatar

    Mark your post as having spoiler content next time, please.

    About your code, the range is wrong and why are you using that filter for? Those things are what makes your code so slow.

  • Default User Avatar

    Either you're using recursion / looping infinitely, or your algorithm is very slow. I'd bet it's the first option, I'm passing JS tests in 2 secs with inefficient algorithm. Try to figure it out with sys-out printlns.