Quest Wars: Win a pass for jPrime 2016 - Questers

Quest Wars: Win a pass for jPrime 2016

25 Jul 2016

As a supporter of the local Java community we are giving away 3 tickets for the second jPrime conference that will take place on 26th and 27th May in Sofia Event Center. The conference is organized by the Bulgarian Java User Group and features a combination of great international speakers along with the best local lecturers.

How to get a pass? By taking part in our Quest Wars and helping us solve the Ewok problem:

Our friends from Ocado are looking to build a store on the Forest Moon of Endor - a store that would serve Ewoks with all the fresh fruit, meat, fish and any other food they need.

Of course, it would only serve customers that are geographically close to it. The store covers a rectangular area, can only serve people living in that specific area and it’s always built in the center of the rectangluar area it serves.

So, given the sides of the rectangular area that the store covers (height & width) and a set of points (customers residence coordinates), what is the best possible location to build the store, so that a highest number of ewoks can be served?

The 3 best code solutions (idea, performance, code clarity, etc) will win a free ticket to jPrime!

Hints:

Point bestLocation(int width, int height, Set<Point> ewokResidences) {

 ....

}

* Points are with integer coordinates

* The store's rectangular area's sides are always parallel to the coordinate axis (has a rotation of 0 degrees)

* There can be multiple answers (best points), we accept any of them