Ad
  • Custom User Avatar

    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.

  • Default User Avatar

    The java version seems correct though. What are the assertion messages you got?

  • Custom User Avatar

    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.

  • Custom User Avatar

    A question, not an issue.

  • Custom User Avatar

    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).

  • Custom User Avatar

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

  • Custom User Avatar

    @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.

  • Custom User Avatar

    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

  • Custom User Avatar

    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 by 2 and 3, read the link in the description on why to proceed with 6k+/-1 numbers), while you should just test until you prove a number is not prime.

    Hope this helps, cheers :)

  • Custom User Avatar

    @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

  • Default User Avatar

    Hi

    Except that "newname = name" is creating an alias of name, not a copy... ;-)

  • Custom User Avatar

    @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 incrementing c only when the command is *, > or <, you should perhaps consider incrementing c unconditionally in your while loop. Hope this helps and don't hesitate to ping me again in case of any further problems.

    Cheers,
    donaldsebleung

  • Custom User Avatar

    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

  • Custom User Avatar

    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.

  • Custom User Avatar

    Sure:

    1. It is definitely not the simple solution, and not the intended solution. If you have to do stuff to the list, you're doing it wrong.
    2. Test cases includes r = 1000000000. Think about how your approach will ever not timeout/run out of memory.
    3. The xrange issue is due to choosing the wrong Python version. You can choose the language version at the trainer, next to the language selection.
    4. Anyways, the existence of that failed test indicates that you've mutated the original list, despite how you might think otherwise. Test cases, even though can be poorly coded (using the same list throughout all tests), does not lie; failing at the same spot as others with a common cause indicates a strong correlation.
    5. I know you spent a few hours trying to figure out why it didn't work and is certainly very frustrated, but there is really nothing wrong with the kata (besides maybe how the test cases are written). So please, don't blame the kata and its author on something that is not their fault - if you write a sub-optimal algorithm and timeouts, that means you need to write a better algorithm :)
  • Loading more items...