Ad
  • 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? :)

  • 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

    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 :)

  • 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 :)