Ad
  • Custom User Avatar

    Solved for two test cases... Got this weird error I've never seen before. Any tips?

    /home/codewarrior/test.coffee:6:1: error: unexpected indentation
          difference = []
    ^^^^^^
    
  • Custom User Avatar

    This feels like a 5, not a 6ku

  • Custom User Avatar

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

  • Custom User Avatar
    sum_pairs([0, 0, -2, 3], 2)
    #  there are no pairs of values that can be added to produce 2.
    == None/nil/undefined (Based on the language)
    

    Yes, you did, but not before using [] and that's why you get the error. Move that if up.

  • Custom User Avatar

    Thanks for the reply @Chrono79. I reread the setup and I can't determine what to return if no winning pairs are found. I tried returning nil if winning_pairs == [], but no luck.

  • Custom User Avatar

    Use p winning_pair to see its value. At some point it is nil and you try to access it with []

  • Custom User Avatar

    Can somone explain this error code to me? Passed all standard tests, but I can't decipher what is triggering this error:

    main.rb:17:in `sum_pairs': undefined method `[]' for nil:NilClass (NoMethodError)
    	from main.rb:34:in `block in <main>'
    	from /runner/frameworks/ruby/cw-2.rb:55:in `block in describe'
    	from /runner/frameworks/ruby/cw-2.rb:46:in `measure'
    	from /runner/frameworks/ruby/cw-2.rb:51:in `describe'
    	from main.rb:31:in `<main>'
    
  • Custom User Avatar

    sweet! solved. thanks :)

  • Custom User Avatar

    No, draw the example as a bar chart, the first number is 7, the next one is 9 (higher than 7), the next one is 6 (lower than 9), and so on. They alternate between higher and lower. So for a given element, except for the ones at each end, the numbers immediatly before and after are both higher or lower than the number itself.

  • Custom User Avatar

    The definition of bouncy is not making sense to me. Can someone articulate it differently and see if it clicks. I can't see the rule that's determining the subarrays. Here is the closest I can get at what the definition means:
    FOR A GIVEN ELEMENT:
    # it MUST be HIGHER than one neighbor AND lower than another neighbor

    please help.

  • Custom User Avatar

    setup should specify whether frog can jump out of either side of the array or not.

  • Custom User Avatar

    The way the tests are written for this kata make it hard to debug.

  • Custom User Avatar

    the universe has a way of balancing things out

  • Custom User Avatar

    Why is this a 5? I've done way harder 6s

  • Custom User Avatar

    I hate this kata, but was a good practice

  • Loading more items...