Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
C tests have test harness warning:
fixture.c:11:52: warning: implicitly declaring library function 'sqrt' with type 'double (double)' [-Wimplicit-function-declaration]
cr_assert_eq(IsCollision(-5, 5, 5.0001, 5, -5, 5*sqrt(5)), true, "Expected true.");
^
fixture.c:11:52: note: include the header <math.h> or explicitly provide a declaration for 'sqrt'
1 warning generated.
looks good!
Something seems off with the C random tests. For example:
< Incorrect Result >
code[13] = {
" uhefkcy mrpdrk uflndjh em zzksswz acry",
"x ogyypkkuvxpxfkajctamdsac uxqk lrsbp f",
"z zwiousp vaozd tygmv wazgstvzx rpbsdnk",
"lixlwoo mam oa ggrzui gtk k rnjcjrjy",
"xvyb gbmlhwcaerzpart dfrjhmlrvinh pvfjz",
"iqvljsba vrsv xl xw njhuq bdllcuuwxwnyw",
"ns ffmvpake q kwnezyhakbq qwxfjplh qvc",
"qfzpnf qabvstbmc bcexzj ucuolr fkov",
"dphohc dqafvqwdpdpowlbd siowt kodkcemb ",
" vepl st hkdi zt gi asvdvq rgvmjjpcuh",
"xmhapp bamj muvhnko uu ywb ynvntvnhdu ",
"eus uwg wmjkz xruttzjgmwy dyjwx ihzvdxa",
"ticc ysrrdcpmhbbzhxpjm uu oqjhikkdkhoa"
}
Submitted: "mmnikmikghmlkkiklklpkiiimjeooolknlikiok"
Expected: "i igh
iiie
i "
Why are you copying the number?
How is calling into the possibly non-trivial function pow() instead of simply writing "diff * diff" a "best practice"?
This approach has zero global ctors (which are a runtime hit).
Ugh. O(n^2) is not a "best practice IMHO.
How is making the code unreadable an improvement? Most code is meant to be read by others, and good C formatting is a virtue.
No need to use slow floating point math! :)
This comment is hidden because it contains spoiler information about the solution
I feel your pain. But it kinda does -- the Description says that it uses x for rows and y for columns. It's messed up, but it is specified.
Very fine! But note you needn't pass 'cols' to floodfill (2D C arrays only need the number of columns to calculate correct the array offset).
Nice!
Note this accesses memory from high-to-low, which is non-optimal for large address ranges. So I wouldn't call this a Best Practice.
Is it me, or does this seem much harder than a 7?
Loading more items...