Ad
  • Default User Avatar

    Добрый день. Имею решение, но не имею возможности правильно его вставить для тесьтрования. Подскажите как это сделать.
    Good day. I have a solution, but I have no way to insert it correctly for testing. Tell me how to do this.

  • Default User Avatar

    the input is an unsigned (32-bit) so it logically cannot be negative; the output is an unsigned long long (64-bit). the tests do show you the input, expected and actual values. your code does not take care of avoiding integer overflow.

  • Default User Avatar

    I am having problems with this kata in C language.

    Example- My test will fail with the following message:

    "for n = 2494392752, expected 4168116981449254, but got 0"

    Despite showing n as a positive integer, this is seemingly not the case as I get a different, non-zero output when changing n to the absolute value of n. This would only make sense if n was somehow negative.

    Additionally, for cases such as this, nothing is printing to the console, allowing me to debug the issue. There are no errors, and I have tried printing both the unsigned long n (unmutated from the function argument) as well as its necessary cast to int.

  • Custom User Avatar

    Approved

  • Custom User Avatar
  • Custom User Avatar
  • Default User Avatar

    some of the tests in the "attempt" section i guess have issues so dont feel too bad. If the main test fails although you have the exact input, check to see if your output has an extra space at the end or in the begining, good luck.

  • Default User Avatar
  • Custom User Avatar

    You're welcome. From your current code, delete the main method you wrote and press test and submit, it should work.

  • Custom User Avatar

    Oh okay thankss!

  • Custom User Avatar

    You don't write a main method here, just write alphabet_position method. Read this: https://docs.codewars.com/training/training-example

  • Custom User Avatar

    I'm using c++ in this question and I'm getting the error "conflicting types for 'main'" but I'm just using a single main function and the given alphabet_position function. The code is working fine on other platforms so what is the issue here?

  • Custom User Avatar

    There is no memory limit in this kata. Your solution has a bug.

  • Default User Avatar

    I am using C++ and this Kata always exits with std::bad_alloc precisely after running the second test prompt with no problem. I feel like this has too little memory assigned, I can't conceive of a way to make my code any shorter. I am simply running one if else if per character in the given string with one extension on the resultant string each and then removing the last character after the for loop to get rid of the last space efficiently so I can just add it in the single extension command of the others. To get the alphabet number I am implicitly converting the chars to the decimal ASCII and subtracting from it to know what to append to the string. I know there exists one function where you can make a reference directory and just directly append by reference but I can't for the life of me find how to do that no matter what I google. This is really frustrating as I feel my solution is really not that bad and yet it is not enough. Do you need to be a C++ Genius to solve a 6Kyu Kata? This should at least be higher kyu for the little memory.

  • Custom User Avatar

    The Mods here are so wonderful!

  • Loading more items...