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.
Rounding method seems ok, if you get differences that high, the problem isn't in the rounding part. Try pasting your code and marking your post as having spoiler content for us to check it.
You should only round the result.
The java version seems correct though. What are the assertion messages you got?
Yes, the flip is disturbing, but since the instructions state this clearly, I can handle it. What bothers me even more is that the instructions do not state how x and y are related to columns and rows. All that is stated is that x: 0, y: 0 refers to top-left. It should be stated more clearly in the instructions whether the x refers to the columns (i.e. the sub arrays in the map) or the rows, (the value of each sub array), especially since they redefined how a 2D map is configured with 2D arrays.
A
question
, not an issue.Hi, can I ask you something? Do you know what the runtime of your solution is? I'm using two reduce methods (1) to populate an object, (2) to find all instances where the sum of the current value is being matched with the difference of the current value and the sum. And accessing that sum is being matched by the object I have constructed earlier. I believe that my solution is O(2n), I just want to know what yours is because one would think that an acceptable solution would be O(n).
This comment is hidden because it contains spoiler information about the solution
@imprezobus, not knowing your code, I would enquire if you did what I suggested above and checked if you were keeping things simple enough while grinding primes to check.
I ranked this kata according to the average rank rating.
It's still possible to change the ranking after approving though. It's not set in stone :P
I concur on the difficulty being well above a 5kyu kata [yellow still meaning "novice], but ranking is out of my hands and often this kind of katas get ranked by power-users who have their own idea (for good or for bad, not telling I am the perfect assesser) of what is tough or not.
Your code, anyway, is far from being efficient, storing and testing each number up to
n
(even including numbers divisible by2
and3
, read the link in the description on why to proceed with6k+/-1
numbers), while you should just test until you prove a number is not prime.Hope this helps, cheers :)
@imprezobus,
Glad to hear that my comment has aided you in debugging your interpreter and many thanks for your kind words and compliments. Once you've completed every Kata in this Series and if you enjoy this Series then don't forget to check out my RoboScript series as well as it is also (to some extent) related to esoteric programming languages and how to interpret them.
Cheers,
donaldsebleung
Hi
Except that "newname = name" is creating an alias of name, not a copy... ;-)
@imprezobus,
Many thanks for posting your solution above; I have tested your solution and found the cause of the timeouts - your solution fails to increment
c
whenever it encounters a non-command character resulting in an infinite loop. I would suggest that instead of incrementingc
only when the command is*
,>
or<
, you should perhaps consider incrementingc
unconditionally in your while loop. Hope this helps and don't hesitate to ping me again in case of any further problems.Cheers,
donaldsebleung
No problem :D Since you marked your comment as a spoiler, you may directly copy and paste your current Python solution here (within a Markdown code block) instead of writing pseudo-code as people who haven't solved the Kata yet cannot see it. That way, it should be easier for me to test your current solution and potentially identify the problem. Cheers :D
Upon reviewing your solution, the first question that comes to mind is, "Why doesn't your interpreter accept any arguments as input?" Your interpreter should receive two arguments, the first one being the Smallf**k code to be executed and the second one being the initial state of the memory tape.
By the way, the solution you posted above isn't rendering properly and is rather hard to read. Consider formatting it using Markdown next time.
Sure:
r = 1000000000
. Think about how your approach will ever not timeout/run out of memory.xrange
issue is due to choosing the wrong Python version. You can choose the language version at the trainer, next to the language selection.Loading more items...