Started with the trivial implementation of scanning all options. As JBM noted (above) It solved the puzzle if number of houses where under 20. 50 was a timeout
So introduced dynamic programming (memoization). Now all is solved, and I’m happy.
Then looked at the top solution - and saw a simple O(n) approach and had a big silly smile all over my face. This is one of the reasons I love CG so much
Good day every one, i pass all the validator test but some how fail the 75 houses test in the submission. Seems rather odd since i pass the 75 houses test in the validation. Anyone got any idea for edge cases i should check ?
The “20 Houses” Validator is the same as the “20 Houses” Test except that the input 12 is replaced by a number greater than 100. Try creating some custom cases to test your code.
Hi codingamers! I pass all the validator test but I fail the 75 houses test in the submission. Since those tests should only prevent hard coded solutions I assume there is a mistake in the test case? Thanks for your help!
Ok, then my bad, should have stated the question differently: I want an admin or something similar to really check the case.
And yes you are right, hundreds of coding gamers already solved the exercise BUT i could also read in the comments that test cases changed over the years and that solution once valid would now fail the test. These things happen.
I coded some hours with with pen and paper, got the algorithm in linear time, typed it in in about 20 minutes and all test cases run through (except those with negative values). I fixed that after a couple of minutes. Thats why now I have the feeling IT COULD BE that the test case has its issues.
I also agree with additional tests as validators, but they shouldnt have the same name. If they have the same name the logic should be the same but with different values (to prevent hard coding).
Thank you.
I wrote 5DN1L and he presented a testcase which his solution passes and mine didnt (now it does ) So thank you very much 5DN1L !
I would suggest to add a small test case in which there are just two houses, this would have done the trick for my false solution.
Long story short: the test cases were alright, my solution was false.
This was indeed what I needed. I was in the exact same situation as @DaMiche, and this extra test case helped me to find my mistake. Is it possible to add this to the test cases of the puzzle?
Cases come in pairs, so if I add that case as a test, I would have to come up with another new case as a validator For the time being, I would prefer leaving the puzzle unmodified.