Ad
  • Custom User Avatar

    Assert.assertEquals("2 * 2", BasePrime.factorize(4))

    Assert.assertEquals("1 * 5 + 1 * 1", BasePrime.factorize(6))
    Assert.assertEquals("1 * 7 + 1 * 1", BasePrime.factorize(8))
    Assert.assertEquals("1 * 19 + 1 * 1", BasePrime.factorize(20))
    Assert.assertEquals("1 * 79 + 1 * 1", BasePrime.factorize(80))

    This makes no sense. Either BasePrime.factorize(4) should result in 1 * 3 + 1 * 1 to follow the same pattern, or all the other test cases should be changed to get rid of the "+ 1 * 1" part and have a correct factorization:

    6  == 3 + 3
    8  == 5 + 3
    20 == 17 + 3
    80 == 73 + 7
    

    Also, this behavior is not even explained anywhere - the author wrote a wrong algorithm and expects everybody to read his mind to know how to solve this.

  • Default User Avatar

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