Ad
  • Custom User Avatar

    If you use result instead of res, you don't need to declare or initialize it.
    It is the return value available automatically.

  • Custom User Avatar

    Definitely!
    A new tag is needed Stupid Practices

  • Custom User Avatar

    This is what people love and hate about C. I find the language almost poetic, sometimes.

    I love it when it's done in solutions of fun problems, but I would hate to maintain such code :D

  • Default User Avatar

    Thanks BDub_88 for taking time to reply. I hope I can contribute too when I become less noob 🙄

  • Default User Avatar

    Yeah, I just suspect they didn't want to change the wording on the question and techincally you don't need the destination parameter but then the function would have to either alter str in place or allocate memory in the function and free it outside. It's easier to just do it the way they have, though I like the idea of altering the string in place.

  • Custom User Avatar

    Would fail if cm overlows as might happen with arr:
    {1,2,...,43}

  • Custom User Avatar

    The description said no need for floats, but double is a kind of float.

  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    The description says it has one parameter but in C it has two parameters as one is convenient preallocated memory for the result.
    A little confusing.

  • Custom User Avatar

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

  • Custom User Avatar

    Couldn't the array be [7][7] instead?

  • Default User Avatar

    Those numbers are correct. The test case just has some big numbers in it, that's all. True, they aren't sorted into any kind of order -- but the kata description never promised they would be.

  • Custom User Avatar

    This is for C:
    While the probability values look ok, the position values of test #4 in Random_Tests are consistently wrong and seem to be very large and not in order.

    11,8
    {(-16807268829305383559342375576237254726043224244224.000000, 0.054688), (-16441893419972657829791454368058183971129241108480.000000, 0.109375), (24845527834625349609462642156176811334150853230592.000000, 0.015625), (-8769009823985417509222108996297698117935595257856.000000, 0.234375), (28499281927952606904971854237967518883290684588032.000000, 0.132812), (365375409332725729550921208179070754913983135744.000000, 0.046875), (24480152425292623879911720947997740579236870094848.000000, 0.070312), (28133906518619881175420933029788448128376701452288.000000, 0.085938), (10595886870649046156976715037193051892505510936576.000000, 0.070312), (-2923003274661805836407369665432566039311865085952.000000, 0.039062), (-8038259005319966050120266579939556608107628986368.000000, 0.140625)}

    {(-13884265554643577722935005910804688686731359158272.000000, 0.109375), (-7307508186654514591018424163581415098279662714880.000000, 0.156250), (-21191773741298092313953430074386103785011021873152.000000, 0.031250), (-12788139326645400534282242286267476421989409751040.000000, 0.234375), (-30326158974616235552726460278862872657860600266752.000000, 0.078125), (-5115255730658160213712896914506990568795763900416.000000, 0.171875), (-25210903243958075339013563364355882089064836366336.000000, 0.171875), (-2192252455996354377305527249074424529483898814464.000000, 0.046875)}

  • Custom User Avatar

    Might crash if string is empty.

  • Loading more items...