Ad
  • Custom User Avatar

    Thankyou hobovsky and trash_incel. The addition of << std::flush allowed me to see that to my surpise the program crashed on the very first test with inputs "2" and "3" even though this compiled and ran with correct result locally. From there I deduced I was getting a -1 index. I had been looping using reverse iterator and was trying to compute the index for my vector to store the computation results using std::distance. This is were things were wrong. I guess that I was either lucky locally or my compiler was doing something smart. I had already made one of my own tests with one number as "" and again this compiled fine and gave the correct result for me locally. Anyway - I have now submitted with success. Thanks both.

  • Custom User Avatar

    On c++ when running test I get the following STDERR:
    double free or corruption (out)
    UndefinedBehaviorSanitizer:DEADLYSIGNAL
    ==1==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f0db73858e0 bp 0x7ffc65681330 sp 0x7ffc656810e0 T1)
    ==1==The signal is caused by a READ memory access.
    ==1==Hint: address points to the zero page.
    ==1==WARNING: invalid path to external symbolizer!
    ==1==WARNING: Failed to use and restart external symbolizer!
    #0 0x7f0db73858df (/lib/x86_64-linux-gnu/libc.so.6+0x408df)
    #1 0x7f0db73ce836 (/lib/x86_64-linux-gnu/libc.so.6+0x89836)
    #2 0x7f0db73d58b9 (/lib/x86_64-linux-gnu/libc.so.6+0x908b9)
    #3 0x7f0db73dce49 (/lib/x86_64-linux-gnu/libc.so.6+0x97e49)
    #4 0x42574d (/workspace/test+0x42574d)
    #5 0x428475 (/workspace/test+0x428475)
    #6 0x426b2e (/workspace/test+0x426b2e)
    #7 0x426673 (/workspace/test+0x426673)
    #8 0x4262ab (/workspace/test+0x4262ab)
    #9 0x42bb25 (/workspace/test+0x42bb25)
    #10 0x42584d (/workspace/test+0x42584d)
    #11 0x7f0db7366c86 (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)
    #12 0x4045a9 (/workspace/test+0x4045a9)

    UndefinedBehaviorSanitizer can not provide additional info.
    ==1==ABORTING

    When I compile my code locally with: $ g++ -ggdb -pedantic-errors -Wall -Weffc++ -Wextra -Wconversion -Wsign-conversion -std=c++17 multiply.cpp -o prog I get no errors. There is a warning about conversion to long unsigned int from int on my variable index which I use to hold a "std::vector<>" result. The program runs with the given tests. I tried using std::cout << "a: " << a << '\n'; and std::cout << "b: " << b << '\n'; to see what inputs the problem might be associated with but this did not work on test. Can someone please advise how I might find th bug?

  • Custom User Avatar

    One of the random tests on C++ is test tX, original Tx, expects true. I think this should be false.
    The description says anagrams are case insensitive. Apply case insensitivity to Tx and tX means they are the same word and not different.

  • Custom User Avatar

    How can I be sure about exactly which test I am failing. The output is:
    Time: 3288ms Passed: 1 Failed: 1 Exit code 1
    Test_Results
    Comp_Tests
    Tests_comp
    ! Expected: true
    Actual: false
    Random_tests

    When i print the inputs it seems like the failure is for input (2,2,3) and (4,9,9) but based on a look through the discussions it looks like this might not be the case? For other Kata a test number is given for each test and a pass or fail output against each.

  • Custom User Avatar

    Great answer - it helped a lot. Instructions clear and easy to follow. I solved the problem and passed all tests. Thanks :)

  • Custom User Avatar

    how do I find out what the inputs were for a failed test? I have submitted a solution in C++ for 'common denominators' and have failed test 3 with output:
    Expected: equal to "(77033412951888085,14949283383840498)(117787497858828,14949283383840498)(2526695441399712,14949283383840498)" Actual: "(3414707982693751,14949283383840498)(1573009032312,14949283383840498)(1612068318217,14949283383840498)"

  • Custom User Avatar

    For the error message ValueError: invalid literal for int() with base 10, I tried Python's

    try: except ValueError: pass

    which worked.

    However, I am no stuck with:
    Input: 't"expEXXk67748NaX2D825897348000089'
    Output says my output:
    't"epEXXk100' should equal 't"epEXXk100'

    I really could do with some help on this one. Any help welcome.

  • Custom User Avatar

    On running sample tests the output says that my code returns [('a',)] should be ['a']. Running my code from windows powershell using both python 2.7 and 3.6 I get out put of ['a'] for an input string of 'a'. Same thing if I run my code using spyder and python 3.6.

    Also I believe somehow you can print what the input was for the test condition that produced the failed output but I cannot see how to do this.

    Help would be most welcome. Thanks.

  • Custom User Avatar

    OK thanks I did not realise that. Not sure how I can print the input. I have not seen how to do this. In the meantime I have been logged out so it seems I have lost the chance to complete the kata.

  • Custom User Avatar

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

  • Custom User Avatar

    Hello Giacomo,

    Thanks for replying.

    I recognise that the instruction states "the next bigger number formed by the same digits" as opposed to "the next bigger number compared to the test input". Even so the next bigger number formed by the same digits as 9876543102 is I believe 9876543120. It uses the same digits as the input and is the next biggest number using those digits. In other words there is a possible combination of the given digits that gives a bigger number which is the next biggest - the number I output is next biggest compared to the input. The "should equal -1" given back as output implies that, using the words in the instructions "no bigger number can be composed using those digits". Besides, in order to make sense of "next" biggest is it not a requirement that "next to what" is known.

    Again why does output give: '21' (in single quotation marks) should equal 21 mean?

  • Custom User Avatar

    On attempt (after run sample tests was successful) I received the following test results:
    9876543102 should equal -1

    My answer was 9876543120 which on reading and checking is greater than the input n of 9876543102 and as far as I can tell the next greatest. Basically the input case is all digits in descending order except the last 2 so swap the last two - or am I wrong ? Please help.

    With different code on run sample tests I receive the following test results:
    '21' should equal 21

    What am I missing please. I have carefully read the instructions, attempted putting in:
    if type(n) == str:
    return int(n)

    which does not help.