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, 24.06.2019 12:50
When is it most apprpriate for a development team to change the definition of done
Answers: 1
question
Computers and Technology, 24.06.2019 15:00
What questions about an audience should be asked during presentation preparation? check all that apply. what does the audience already know about the topic? how will multimedia tools inspire the audience? is the information interesting and engaging? how will this information affect the presentation? will the audience change the message’s purpose? what is likely to interest the audience?
Answers: 3
question
Computers and Technology, 24.06.2019 16:00
What is a dashed line showing where a worksheet will be divided between pages when it prints? a freeze pane a split box a page break a print title
Answers: 1
question
Computers and Technology, 24.06.2019 19:00
Which of the following "invisible" marks represents an inserted tab?
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
Physics, 21.12.2020 19:40
question
Mathematics, 21.12.2020 19:50
Questions on the website: 13722362