Find the house numbers between which Noddy can build the largest house | faceprep

Find the house numbers between which Noddy can build the largest house | faceprep

In the city of Toy land, there are N houses. Noddy is looking for a piece of land in the city to build his house. He wants to buy the land where he can build the largest possible house. All the houses in the city lie in a straight line and all of them are given a house number and position of the house from the entry point in the city. Noddy wants to find the house numbers between which he can build the largest house.



Find the house numbers between which Noddy can build the largest house



Input: The input to the function/method consists of two arguments

  • numOf House, an integer representing the number of houses.
  • houseList, a list where each element of the list is a list of integers representing the house number and its position respectively.




Constraints

2 < numOfHouse < 106

1 <houseList[i][0] <numOfHouse

0 < houseList[i][1] < 106

0 < I < numOfHouse

Note: No two houses will have the same position. In case of multiple such answers, return the one with the least distance from the reference point Zero.

Example:nInput:nnumOfHouse = 5nhouseList = [[3, 7],[1, 9],[2, 0],[5, 15],[4, 30]]nOutput: [4, 5]nnnExplanation:nThe largest land area with size 15 is available between the 4 and 5 numbered houses. So the output contains these house number s in ascending order.n




Find the house numbers between which Noddy can build the largest house


Solution to build the largest house

@@coding::2@@


Some Suggested Articles :



c