I'm pretty dumbfounded with 15A(15A - Cottage Village). I thought I figured this problem out yet there seems I still miss something. I get a wrong answer for case 11 which is too big to manually check, yet I've got no further ideas on how to improve my code. Any visible flaws or missed points?
My idea was to sort all the x-coordinates of houses' endpoints and iterate with i+=2 (to avoid overlapping houses) over them and check whether another house fits perfectly (count++) or if some space is still left for another possibility (count+=2).
Here is my submission: 112622985
Any help is greatly appreciated. Thanks a bunch
Have you tried the following:
98% of WAs and REs can be resolved this way. People here don't have the time to delve into every code posted here, it's much harder to debug somebody else's code and being able to debug your own code is a valuable skill. It is also a very routine process that can be learned much faster than problem solving and algorithms.
hmm ...
Thanks, I'll definitely try that out
It's called 'stress testing' if you wants to find more about the topic