Ad
  • Default User Avatar

    This is the last example in the discription, and should be false as the discreption indicates.
    This test case must be wrong for some languages.

  • Default User Avatar

    I'm stuck on the same case in Rust, yet it has 1k solves.

    vec![121, 144, 19, 161, 19, 144, 19, 11], vec![121, 14641, 20736, 36100, 25921, 361, 20736, 361]
    
    assertion failed: `(left == right)`
    left: `false`,
    right: `true`
    

    I assume the case was meant to have 19, 19, 190, not three 19s.

  • Default User Avatar

    I am afraid I do not understand you completely.

    What you print is not the case expecting true.

    Yes, we are positive. My code indicates the answer for this particular testcase is false. I have described the reason in previous message.

    From your answer I understand the output should be 'false'.

    Therefore, kata returning assertion error as follows:

    expected:<true> but was:<false>
    

    seems to me like a bug. Testcase expects the result to be true, where my code and your answer states it should be false.

    If my thinking is wrong, could you please elaborate a bit more? :)

  • Custom User Avatar

    Read the description carefully. What you print is not the case expecting true.

  • Default User Avatar

    Pretty sure there is a bug in Kotlin testcases.

    My code to print test cases:

        println("a\n")
        a.forEach { e -> println(e) }
        println()
    
        println("b\n")
        b.forEach { e -> println(e) }
        println()
    

    Execution

    a
    
    121
    144
    19
    161
    19
    144
    19
    11
    
    b
    
    121
    14641
    20736
    36100
    25921
    361
    20736
    361
    

    Result

    expected:<true> but was:<false>
    

    Expected true, but in b array there is value 36100. sqrt(36100) = 190. There is no 190 in array 'a'.

  • Default User Avatar

    Right but it also doesn't specify what color socks you should wear. Both of those things are out of scope for the kata.

  • Default User Avatar

    In Java I had to specify value returned, when there is no N found in given range.
    This case is not specified in kata. Saying it will never happen does not prevent me from handling such a case.

    I returned '-1' when there is nothing found. It works, but I would much rather know how to program it, rather than guess.

    Also I must agree, that for such an easy task it has way too much explanation and examples.

  • Default User Avatar
  • Default User Avatar

    Thank you, fellow warrior :)

  • Custom User Avatar

    in SQL katas, you don't have to build a function/procedure (I mean, you can, but it isn't what makes you complete the kata), but you have to write a SELECT statement that is returning all the results. I guess you forgot that part.

    => copy your current code, then reset the trainer and you'll see the initial code. You just have to modify it a bit to pass the kata.

  • Default User Avatar

    I am trying to pass it in SQL. I have developed proper method in local postgresql (create function past(h integer, m integer, s integer) and all logic under it) and by calling it select past(1,2,3); it generates proper response. But pasting my postgresql method here returns with errors, the answers are quite different. Please, guide me how those SQL kata should be entered :)