Ad
  • Custom User Avatar

    Are numbers with 3 different sums (e.g. 87539319 = 167³ + 436³ = 228³ + 423³ = 255³ + 414³) considered as a case where you should return true?

  • Default User Avatar

    In the description, the reduce() method is required to return a lambda object, but the tests expect a string instead.

  • Custom User Avatar

    Java: Random tests will always expect false, even when the ultra rare chance occurs, that an actually true case was drawn.

  • Custom User Avatar

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

  • Custom User Avatar

    The input x of the polynomial function must be between -11 and 11

    This is not checked (at least in python).

  • Custom User Avatar

    Don't we need to know anything about alpha-reduction to pass this kata?

    If the reduced left side is an abstraction, substitute every occurrence of the input variable of the abstraction in its body with the reduced right side of the application, and reduce again.
    

    You don't explain how we should "apply" terms.

    Otherwise, just apply the reduced terms to each other.
    
  • Custom User Avatar

    Are the coefficients always integers?

  • Default User Avatar

    So I was able to solve this on here, it's pretty simple, but I wanted to go through and try to write it all out in VSCode. How would I do that? I want to put the triangle and the similar outputs in my file_name_spec.rb file to populate the solutions I need. I have everything as individual arrays (e.g. method_name([1]).to e(1), ([3,5].to e(8)) etc.) I'm trying to do it like this because I am new to programming and looking for work and have been asked to use my prefered editor to solve the problems I've been given in interviews and I'm not yet use to having to build out all the files on my own. In the course I took everything was already laid out for me, all I had to do was run bundle an solve the problem. Any help at all with how I could do this in VSCode would be great, thanks!

  • Custom User Avatar

    Ruby 3.0 should be enabled, see this to learn how to do it

  • Custom User Avatar

    The test suite doesn't provide polynoms with large coefficients associated to the highest term, for now. That allowes wrong approaches to pass. Tests should be adde'd for that.

  • Default User Avatar

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

  • Custom User Avatar

    Take a good look at triangle row sum, once you see it you will know what to do...

    *Take a break but never give up!*

  • Custom User Avatar

    Ruby code-

    Below code (as triangle over multiple lines) in string format works. When running tests and submit in CW's its calls 'NilClass' error for the triangle.

    The triangle in the example, this is a String class structure?

    $triangle =
    '1
    3 5
    7 9 11
    13 15 17 19
    21 23 25 27 29'

    def row_sum_odd_numbers(n)
    if $triangle.class == NilClass
    return 1
    else
    new = []

    $triangle.each_line {|x| new << x.split}
    
    var = new[n-1].each.inject(0) {|x,y| x.to_i + y.to_i}
    
    return var
    

    end

    end

  • Custom User Avatar

    In the kata, my code calculates Math.cbrt(1728) === 11.999999999999998 instead of 12. (I'm writing in JS). The web app I use to test it (repl.it) does not have this same error, which makes it kind of hard to debug. I assume that it's some kind of floating point error related to converting between binary and decimal, but that's all I've got. Does anyone have any advice on where I could find some resources on this, or what this kind of issue called so that I can look it up myself.

    Beyond that, does anyone smarter than I have a reason why this error is present on CodeWars but not repl.it?

  • Custom User Avatar

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