Ad
  • Custom User Avatar

    Please scroll up this page and find "Test Cases" section (next to "Description"). If you expand it you will see the list of all "attempts".

  • Custom User Avatar

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

  • Custom User Avatar

    Also, if using static member variables, re-initialize them all inside the Justify method.

  • Custom User Avatar

    I had this problem as well. I have never had to test for null when the parameter is typed string in any other katas. I think this is an error in the kata. I added this code to mine to fix it.

    if (str == null) {
      return string.Empty;
    }
    
  • Custom User Avatar

    One of the tests is NULL. Not an empty string, but NULL. You have to return an empty string if you get NULL, despite that not being mentioned in the requirements.

  • Custom User Avatar
    1. Letters and bombs stay in place when another bomb explodes ("ww_____").
    2. Same as point 1.
    3. Why do you care about them? They don't influence the outcome.
    4. But are you explicitly asked to validate the input?
    5. Power is the same as damage, not health. Also, look at point 1...
  • Custom User Avatar
  • Custom User Avatar

    The * bombs kills the adjacent letters ( i.e. aa*aa => a___a, **aa** => ______ );
    Your case: www*w*** => ww______
    Nothing is reacting on a bomb in this Kata.
    No checking for upper case is needed.

    Btw! Did you solve this Kata Alphabet War?
    Then it will be more obvious for you what letter power does mean...
    Hope it helped...

  • Custom User Avatar
    1. what happens in that case: wwww**
      Do the letters die first and the bomb disappear -> ww_^*** ->ww***
      Or the letters "die twice" from the same explosion -> wwww** - > w
      ^^^^
    2. Does a bomb can explode other bomb or it skips that? will the letter W die here: wa**
    3. "dashes and dots are spreaded everywhere on the battlefield"
      how they react to a bomb, like every other letter?
    4. "accepts fight string consists of only small letters"
      do i process the input to ignore all other cases or return something like "Input isn't valid"
    5. what does it means that letters has power, u gave no example of how it's being reflected
      is it for summing up the scrores of the remaining letters when the airstrike ends?
      or a letter with power of 2 can tolerate 2 bombs before it dies
  • Custom User Avatar

    The greatest common denominator for 195595 and 565071 is 1. Meaning: you can't reduce the fraction to anything else.
    That is why you return the fraction in its original format.

  • Custom User Avatar

    I'm just wondering why my solution worked in C# (where the timeout was set to 12 seconds if I remember correctly), and the same approach in Java (with a timeout of 16 seconds) did not pass...

  • Custom User Avatar

    Question is badly structured and... makes no sense? I can't even tell if you're happy about time-out or you can't put your thoughts into words correctly.

  • Custom User Avatar

    I need help/ advice. Please.

    One of the helper methods I created is to check if the Bigint/ int contains decimal.
    If it contains decimal we would not count further.

    However we do not have BigDecimal in C# only BigInterger.

    Factorial 45! is huge number. How can I find if decimal exist in bigint?

    public static int divisableCounter (BigInteger totalFactorial, int primeNumber)
    {

            decimal bigDecimal = (decimal)totalFactorial;//this fails at test 45!
            int divisableCounter = 0;
            
            do
            {
                bigDecimal= bigDecimal / primeNumber;
                if (bigDecimal % 1 == 0)
                {
                    divisableCounter++;
                }
                else break;
    
            } while (true);
            return divisableCounter;
    
        }
    
  • Custom User Avatar
  • Custom User Avatar

    It is 12 factorial which is written as 12! and it is equal to 12111098765432*1. When you multiply that you get 12!=479001600.

  • Loading more items...