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.
I wish they would update the compiler, I got burnt on writing a Fortran Queue that makes use of allocatable data types. I wrote it in Visual Studio, but when I copied and pasted the code it the CodeWars compiler bounced back saying it did not support allocatabled data types.
That is:
TYPE QUEUE
INTEGER:: I
TYPE(QUEUE), ALLOCATABLE:: NXT
END TYPE
Resulted in the compiler complaining:
TYPE(QUEUE), ALLOCATABLE:: NXT
is not allowed when it is part of the Fortran 2008 Standard
Seriously. The description makes it seem like the algorithmic complexity isn't a factor. I would have approached this problem completely differently if I'd known the "relatively small" n would timeout. A bit frustrating to be honest, especially considering how many comments are pointing this out.
Thanks!
@Phil157 If you are stuck with the Fortran version of this Kata, feel free to post your code here and mark it as a spoiler so I can review it and perhaps provide some feedback, cheers :)
I think this output issue is due to the Fortran CW-2 testing framework itself. I'll look into improving its output by replacing special characters (such as newlines) with their escape sequence equivalents (e.g.
\n
) in my spare time.I am asking @donaldsebleung to see your posts (he is the Fortran translator).
Outputs are different through languages.
"(3(A, I0), A)" is good practice.
Bravo! You win too!
Rule 0 of any algorithm problems: Don't micro-optimize if your algorithm is at the wrong complexity ;-)
There are 200 random tests. My solution runs in about 700 ms so I think the number of tests is correct. Maybe the sort on the fly takes too much time. Think more about how you put the numbers in your array and avoid to sort.
I'm afraid there are only the two of us to take this kata in Fortran...
I was running into a similar problem and talked to donaldsebleung about it (easy enough to comment on one of his Fortran solutions). His method, however, was to first create a static-length string, and then build from that. It seems Fortran has some ability to autosize strings, but only if it's built of existing strings and you concatenate. Writing directly into such strings I haven't fully sorted out yet. Often, I'm frustrated by Kata that are challenging mainly because of arbitrary string formatting output rather than programming or mathematical difficulty.
Agree. If for the first year the population declines then it will never get to
p
Really weird! I completed my bug report https://github.com/Codewars/codewars.com/issues/1436. Thanks for your post.
I suppose that happens when you copy and paste my solution.
The Fortran translation is well written but CW has replaced in the visible solution
1_ikind
by_ikind
hence the problem when you copy and paste my solution...I re-published the translation but the problem remains in the tests.
I suppose it is only a problem "on the screen" since your solution passed the tests.
I have signalled this bug: https://github.com/Codewars/codewars.com/issues/1436 number #1436.
Thanks for your post.
By the way, please be patient when asking for help.
If you're having a problem with a kata, ask questions and move on to another one. Don't expect immediate responses because they're just regular users like yourself. They're in different time zones, may not have time during weekdays, etc.
If your issue is about Codewars itself, then open an issue on GitHub so that we can look into the problem.
Loading more items...