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.
Problems like these have nothing to do with coding skills. If you know the algo, you can do it, otherwise you'll keep staring at it for a week and still get nowhere.
Dies of cringe
This comment is hidden because it contains spoiler information about the solution
it's most of what it takes to be a good coder for sure
I might be a bit late here, but here it is:
since the function is given as:
Data* sqInRect(int lng, int wdth) {};
you must return a pointer to the struct. You have two options.
initialize with a pointer:
Data *output;
...
return data;
or return the pointer to your struct.
Data output;
return &data;
Yes of course languages are different (to me, that's kinda the whole point of resoving a kata in multiple languages) but there's certainly nothing unfair about that.
Hi @EmperorMigx, over 400 coders have solved it in C ... sorry, but don't just assume the kata is wrong. Your code times out because it's inefficient or has an infinite loop.
aha! so I guess that's also where there's a
conversion from 'long long int' to 'long int'
, because that's also not in your submitted code, amirite?Hi @EmperorMigx, I don't see how this error occurs from your submitted solution. Because your error message implicates line
49:17
, but your code only has 49 lines and line 49 is the closing}
of the function ... wat?Hi @EmperorMigx, what numbers did you get larger than
LONG_MAX
, and what happened during testing to show that? Thanks.This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
For this, you only need to check the lower 32 bits. So you'd be checking if a 1 exists in any odd position of 00000000000000000000000000010000, which is technically the same as checking if a 1 exists in an odd position in 10000 and in 00010000. We are checking odd position from the right. Let me know if this answers your question!
Loading more items...