Ad
  • Custom User Avatar

    All is fixed!
    Except suggestion to check for zeros in random tests, because if we create array with 100 elements, one of them would have zero. I wrote test to prove it, it imitates creation of 1 million arrays with 100 elements and all of them contain zero, please take a look:
    @Test
    void testZeros() throws Exception {
    Random random = new Random();
    for (int i = 0; i < 1_000_000; i++) {
    boolean containsZero = false;
    //imitates creation of array with 100 elements
    for (int j = 0; j < 100; j++) {
    if((random.nextInt(100_000) + "").contains("0")) {
    containsZero = true;
    }
    }
    if(!containsZero) {
    System.out.println("there is no zero in " + i + "array");
    throw new Exception();
    }
    }
    System.out.println("All arrays contains zero");
    }

  • Custom User Avatar
    • Sample tests and submission tests are swapped.
    • There's no fixed tests in full test suite.
    • The custom assertion message is totally redundant: "expected 333122 but was 312 ==> expected: <333122> but was: <312>". Much better idea would be to use custom assertion message to present input of a failed test.
    • Creating new instance of Random on every turn of the test loop is wrong. An instance of Random should be created ideally only once, for example before the test loop, or as a field of the test class.
    • It would be nice if at least some random tests would be guaranteed to generate inputs with zeros.
    • 10 random tests is somewhat few. Generally accepted practive is 100, but it can be a bit more, or fewer if you are able to guarantee a decent coverage.
  • Custom User Avatar
  • Custom User Avatar

    It's a puzzle, so we can't really give any hint. All I can say is that you should be able to see the flag with your eyes, if you do it right.

  • Custom User Avatar

    any tips? I have left only this kata left on level 7 in java, need help! I understand that flag encoded in FLAG variable somehow with number 16, I tried to get every 16 letter, I tried to use online auto decoders, please help!

  • Default User Avatar
  • Custom User Avatar

    Great kata, thank you!

  • Custom User Avatar

    Thanks, you helped me to understand this task