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