Ad
  • Default User Avatar

    actually i solved the kata initially i didnt get what this kata wants
    "You need to find all number that doesnt contain 5 in them in a given range and return the total of such number"
    like 54 has 5 in it, we should not count it and also range can contain -ve number so watch that out

  • Default User Avatar

    same here man

  • Default User Avatar

    Hi, Actually i had same thoughts about if else heirarchy(still i have same).
    Before writing this comment i executed following code in C in Code Blocks 16.01
    int x=1;
    if(x==1)
    printf("1");
    else if(x>0)
    printf("2");
    else if(x<3);
    printf("3");

    and i got 13 as answer(in C) so based on this fact that if else is same for every programming language i commented on this.
    but but i also tested this in differnet language after reading ur comment i got answer as 1 only.

  • Custom User Avatar

    That's not how else ifs work. Once one if is satisfied, it breaks out of the else if chain. By your logic, 15 would actually be added thrice: 15 % 3 == 0 and 15 % 5 == 0 so that will trigger the first one, then the second else if will trigger and so will the third.

    The test case implies there is an array being passed, yet you say that number is not an array.

    Edit: Also, you are simply console.log(abc) rather than return abc, might that be the issue?

  • Default User Avatar

    If a number such as 15 has encountered in your case it will be added twice
    1st in first if case and 2ndly in 3rd else if case so just put your 1st if statement having '||' instead of '&&' so it will take care of every case.

  • Default User Avatar

    iam getting this error
    "terminating with unexpected exception of type std::exception*"
    Language used is c++

  • Custom User Avatar

    The same happened to me but I fixed it by removing some print statements. Just in case anyone else has this issue.

  • Default User Avatar

    thanks i got it

  • Custom User Avatar

    If it keeps happening you might have either allocated an array too big, or your code is too slow.

  • Default User Avatar

    iam able to pass test cases but while attempting it shows
    "Server Execution Error:
    The server attempted to execute your code but there was an issue with the request. This should be a rare issue. Please try running your code again. If the issue persists, please contact us."

    help plz

  • Default User Avatar

    iam able to pass test cases but while attempting its showing Process exited prematurely with a SIGSEGV signal.
    "is there any memory limit" and my code is not trying to accesss any invalid memory!!!
    because i have tested my code in my IDE by those cases were in final test cases
    i got final test case by removing all of my code and just printing vector passed and by seeing expected result

  • Default User Avatar

    Expected: equal to [ J vltasl rlhr , zdfog odxr ypw, atasl rlhr p , gwkzzyq zntyhv, lvz wp!!! ]
    Actual: [ J vltasl rlhr , zdfog odxr ypw , atasl rlhr p , gwkzzyq zntyhv , lvz wp!!! ]

    i'am not getting it....
    please help.

  • Default User Avatar

    tell me how you solve this problem
    i'am getting same problem

  • Default User Avatar

    my answer is correct but its shows following output

    Time: 11ms Passed: 0 Failed: 0
    Test Results:
    dont_give_me_five_tests
    example_tests
    Log
    8Expected: equal to 8
    Actual: 0

    -------help me out plz------