Ad
  • Default User Avatar

    I couldn't get console.write to work when it was timing out.

  • Default User Avatar

    For C# (and possibly the tests for other languages), your code needs to be able to handle prime numbers up to 1 million. I think it would have been helpful to have this information included in the question, as I kept timing out and without seeing the test input I couldn't work out why.

  • Default User Avatar

    I had this problem as well. I have never had to test for null when the parameter is typed string in any other katas. I think this is an error in the kata. I added this code to mine to fix it.

    if (str == null) {
      return string.Empty;
    }
    
  • Default User Avatar

    I'm sorry, I don't understand what you mean.

  • Default User Avatar

    Hi Suic,

    Thank-you for your input.

    1. I have fixed the order of the arguments.
    2. I have added random tests.
    3. I have made the description less ambiguous.
      I searched for other katas and did not find any that were exactly the same. Although there are other katas involving reversing strings, I could not find any that required the reversed strings to be in title case.
  • Default User Avatar

    I agree that this is a problem. I did the problem in C#. I am fairly confident my original solution was correct, but it was failing a test. After seeing this comment I 'fixed' my solution by subtracting a year from my loop and it works. The issue is with the Random Test, unfortunately without knowing what values are used it is impossible for me to show you mathematically what is wrong with the test. However, if you have a look at the solution I have submitted, you can see how I am looping for 1 less year than I should be.

  • Default User Avatar

    Just solved this one, its definitely the hardest one I've done so far! The trickiest part to implement is '[' and ']' commands. If you are using Array.FindIndex('[') or something similar you are doing it wrong. You need to pair the brackets, like how brackets are paired when writing code. For example in ,[.[-],] the first [ pairs with the last ]. Also, remember to be really careful about whether you are changing the data pointer or the instruction pointer, it's easy to make a mistake! I found the output from the second test to be confusing, however the issue I had with passing the 2nd test was also picked up by the 3rd test. I am not sure how much memory is needed for the test cases, but when I submitted mine I used a byte array of 10000. However, for the the 3 sample problems, I can pass them using a byte array of size 100.

  • Default User Avatar

    I think a lot of people in this discussion are overthinking the problem. You can use the time for each block to work out how many blocks the walk should be (HINT: All walks will be the same number of blocks). The walk must return to the same point as the walk started. A walk that takes 8min, but finishes a 2min walk away from start would be invalid. A 6min walk that finishes at the starting point would also be invalid. Lastly, walks don't need to be sensible, like in a loop or anything. A walk that was just north, south repeated 5 times would be valid. You are just checking that the walk is the correct length, and the end location is the same as the start. I did it in C#, so I can't say whether the tests for other languages are the same though.