Ad
  • Custom User Avatar

    This is by far the most readable and clear solution

  • Custom User Avatar

    Thanks for your reply. As expected it was performance issues. Test 30 seems slightly too complex to brute force as I was trying ;)

  • Custom User Avatar

    Here is the log of my code(3 times ran):

    Time: 3540ms Passed: 132 Failed: 0
    Test Results:
     Basic Tests
     It should works for basic tests. (32 of 32 Assertions)
    Completed in 70ms
     100 Random Tests --- Testing for correctness of solution
     It should works for random tests. (100 of 100 Assertions)
    Completed in 2881ms
     Happy Coding ^_^
     Log
    I'm waiting for your feedback, rank and vote.many thanks! ;-) 
    You have passed all of the tests! :)
    
    
    
    Time: 3430ms Passed: 132 Failed: 0
    Test Results:
     Basic Tests
     It should works for basic tests. (32 of 32 Assertions)
    Completed in 85ms
     100 Random Tests --- Testing for correctness of solution
     It should works for random tests. (100 of 100 Assertions)
    Completed in 2692ms
     Happy Coding ^_^
     Log
    I'm waiting for your feedback, rank and vote.many thanks! ;-) 
    You have passed all of the tests! :)
    
    
    Time: 5066ms Passed: 132 Failed: 0
    Test Results:
     Basic Tests
     It should works for basic tests. (32 of 32 Assertions)
    Completed in 70ms
     100 Random Tests --- Testing for correctness of solution
     It should works for random tests. (100 of 100 Assertions)
    Completed in 4389ms
     Happy Coding ^_^
     Log
    I'm waiting for your feedback, rank and vote.many thanks! ;-) 
    You have passed all of the tests! :)
    

    So, if your code got timeout, please check it about performance ;-)

  • Custom User Avatar

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

  • Custom User Avatar

    Now it passed. I paste the code from another code editor and it passed. I'm pretty sure that you said above was the answer of the inconvenience. Thanks for asking.

  • Custom User Avatar

    That's the same as mine and it worked fine. Make sure you have no new lines or spaces after that, it seems it counts that as more chars.

  • Custom User Avatar

    Taxes? ;)
    Seriously talking it counted my code length right, do you have some weird char or something?

  • Custom User Avatar

    My code has 24 characters and the test counts 30. Why?