subject

You are given 2 arrays representing integer locations of stores and houses (each location in this problem is one-dementional). For each house, find the store closest to it. Return an integer array result where result[i] should denote the location of the store closest to the i-th house. If many stores are equidistant from a particular house, choose the store with the smallest numerical location. Note that there may be multiple stores and houses at the same location. Example 1:Input: houses = [5, 10, 17], stores = [1, 5, 20, 11, 16]Output: [5, 11, 16]Explanation: The closest store to the house at location 5 is the store at the same location. The closest store to the house at location 10 is the store at the location 11.The closest store to the house at location 17 is the store at the location 16.Example 2:Input: houses = [2, 4, 2], stores = [5, 1, 2, 3]Output: [2, 3, 2]Example 3:Input: houses = [4, 8, 1, 1], stores = [5, 3, 1, 2, 6]Output: [3, 6, 1, 1]

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:30
Linda subscribes to a cloud service. the service provider hosts the cloud infrastructure and delivers computing resources over the internet.what cloud model is linda using
Answers: 1
question
Computers and Technology, 22.06.2019 10:00
Create a word problem that involves calculating the volume and surface area of a three-dimensional object. cube: surface area 6 s2 , volume s3
Answers: 3
question
Computers and Technology, 22.06.2019 10:50
Write a 3-4 page apa formatted paper comparing your organization’s it strategy with the best practices outlined in your course text. content should include, but not be limited to: developing and delivering on the it value, developing it strategy for the business value and linking it to business metrics. your paper should include an abstract and a conclusion and a reference page with 3-5 references
Answers: 1
question
Computers and Technology, 22.06.2019 19:10
How might the success of your campaign be affected if you haven’t carefully completed all field data or if you accidentally insert the wrong merge field in the document?
Answers: 1
You know the right answer?
You are given 2 arrays representing integer locations of stores and houses (each location in this pr...
Questions
question
Mathematics, 08.12.2020 02:20
question
Mathematics, 08.12.2020 02:20
question
Mathematics, 08.12.2020 02:20
question
Mathematics, 08.12.2020 02:20
question
Spanish, 08.12.2020 02:20
Questions on the website: 13722363