Ad
  • Default User Avatar

    Hi,

    it's great that you translated my kata into Python and I'm glad you liked it :-).

    However, I'd do a few things differently if I were you:

    • You wrote if ...: ... i+=1 else: i+=1 => the else is not necessary, you could get rid of the else and write i+=1 outside the if
    • in this case, i+=1 does not do anything because i is defined by the for loop at the beginning of each iterations. You can replace i+=1 by i+=1000 and your program still works. You could get rid of i+=1 or even better, replace the for loop by a while loop.

    Let me know what you think.

    Cheers.

  • Default User Avatar

    Thanks for the tip ... i had missed that part as well ... became a lot easier once I read it :-)

  • Default User Avatar

    There's an HTML error in your third test, there is a quote missing:

    Test.expect(escapeHTML('This is <a href="http://appsunited.net>my website</a>') == 'This is &lt;a href=&quot;http://appsunited.net&gt;my website&lt;/a&gt;');

    Maybe it is on purpose. If so, you might want to add in your description that valid HTML is not a requirement.

  • Default User Avatar

    I think there is a syntax error in the test case in the ruby version of this kata. I've just solved it: running the test case gave me "syntax error" in the output. I didn't look further and just submitted my solution, which seemed to have worked.

  • Default User Avatar

    Something like that, in this kata, a plateau is just a set of consecutive points with the same value. Let me know if it is not clear.

  • Default User Avatar

    Sorry about that. In a mathematical function or an array of numbers, a local maximum is a point that has a higher value than the points directly surrounding it. for example, the array [1,3,7,4,3,6,2] has two local maxima: the first one in index 2 since 7 > 3 and 7 > 4 and the second one in position 5 since 6 > 3 and 6 > 2. Hope this helps.

  • Default User Avatar

    Thanks for this neat kata !!

  • Default User Avatar

    Thanks much!! Got it working : ) The way it works seems a little awkward to me but it's working : ) so what happens in this example if we remove 8? will it then become something like (if i didn't make any mistake while copy-pasting) {value:4,left:{value:2,left:{value:1,left:{},right{}},right{value:3,left:{},right{}}},right{value:12,left:{value:10,left:{value:9,left:{},right{}},right{value:11,left:{},right{}}},right{value:14,left:{value:13,left:{},right{}},right{value:15,left:{},right{}}}}}?

  • Default User Avatar

    i really thought i had figured this out. i'm also passing all tests except for one, the "Share either 5's subtree or 7's subtree" test.

    I don't get it, I tested the following:

        mt = new EmptyBinaryTree;
        t1 = mt.insert(8).insert(4).insert(2).insert(1).insert(3).insert(6).insert(5).insert(7).insert(12).insert(10).insert(9).insert(11).insert(14).insert(13).insert(15);
        t2 = t1.remove(6);
        print(t1.left.right.left == t2.left.right)     
        print(t1.left.right.left === t2.left.right) 
        print(t1.left.left === t2.left.left) 
        print(t1.right === t2.right)
    

    All of those print "true", which makes me think that I am sharing all that I can including the 5's subtree. Any clue to what I could be doing wrong? In any case, this has been pretty neat.

  • Default User Avatar

    Nice! I see it in the describe/it functions too ... did it have a different name (like assertSimilarScores?) 10 minutes ago or am I going crazy?

  • Default User Avatar

    That was nice! From the description, I didn't really understand how to use the checkScore(score,expected) function. Is the score a score-breakdown object? or an integer? what about expected? I must admit I didn't play with it, im sure i could have figured it out but not understanding the description was enough for me not to want to use it. Otherwise, great work!

  • Default User Avatar

    There's a missing word in the description "any number of as arguments"

  • Default User Avatar

    yes, this is not a "bugfix".

  • Default User Avatar

    yes, please add something in the description about nil-values.

  • Default User Avatar

    Looks like the link is now totally gone (but you might be editing it as I'm writing this)

  • Loading more items...