Ad
  • Custom User Avatar

    I think that is the programming part here, discovering the math and then implementing it. Looking at the wikipedia page, you're not going to reinvent that through trial and error.

    The formula given is a recursive one, which will break, so your programming challenge is how do you make it non-recursive.

  • Custom User Avatar

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

  • Custom User Avatar

    Pet peeve.

    fib(0) = 0
    fib(1) = 1
    fib(2) = 1
    
  • Custom User Avatar

    You can process all 12,000 in under a second. So the test cases should simply be a lookup rather than generating the solution for each random test. This would let you increase the random tests to say 500 or so.

  • Custom User Avatar

    I'm not surprised someone else did it this way, I'm actually more surprised that only 1 other person did it this way.

  • Custom User Avatar

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

  • Custom User Avatar
  • Custom User Avatar

    test case: "(abc) def-ghij"

  • Custom User Avatar

    I see some posted (python) solutions that only passed because they hit attempt a few times in a row until they got a set that didn't have the test case they missed.

    Suggest you add these test cases:

    Test.describe("x_elf Tests")
    print("this one can return ((87*20)-84)/69, your answer is:",equal_to_24(87,20,84,69))
    Test.assert_equals(eval(equal_to_24(87,20,84,69)) , 24)
    print("this one can return 72/((6*16)-93), your answer is:",equal_to_24(72,6,16,93))
    Test.assert_equals(eval(equal_to_24(72,6,16,93)) , 24)
    print("this one can return (98/(76-74))-25, your answer is:",equal_to_24(98,76,74,25))
    Test.assert_equals(eval(equal_to_24(98,76,74,25)) , 24)
    
  • Custom User Avatar

    I'm blown away by how close this is to the method I came up with. Pretty cool!

  • Custom User Avatar

    @KenKamau and @myjinxin2015

    Please either fix the link to indicate the "challenge version" is javascript only, or fix the challenge version to have the same languages.

    I don't really want to learn a new language just to clear that kata from my "unfinished kata" list! =D

    Nevermind, I googled enough javascript (how do I write a if/for loop) to put together a solution that worked and I'm happy with.

    But I still think you should put a warning on the link.

  • Custom User Avatar

    Do you mean this test:

    2 + 3 * 4 / 3 - 6 / 3 * 3 + 8
    2 + (3 * 4) / 3 - 6 / 3 * 3 + 8
    2 + ( 12 / 3 ) - 6 / 3 * 3 + 8
    2 + 4 - (6 / 3) * 3 + 8
    2 + 4 - (2 * 3) + 8
    2 + 4 - 6 + 8
    

    The answer IS 8. You might have done something wrong.

    Sounds like you're evaluating + before - rather than at the same time.

  • Custom User Avatar

    Invalidate python solutions that use eval or exec. You have test cases that check for it, but then there are multiple posted solutions from people that did use it anyway. Either it's allowed or not. Remove/invalidate the solutions that used it.

  • Custom User Avatar

    First thing I tried, but the test cases flagged eval (and exec) as cheating. =/

  • Custom User Avatar

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

  • Loading more items...