Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are pruning a list of N possible hotels to spend the night at for a trip. You don't want to spend too much money
You are pruning a list of N possible hotels to spend the night at for a trip. You don't want to spend too much money on the hotel, so you will choose only a hotel that has a price of at most max dollars per night. Additionally, you don't want to spend the night a bad hotel, so you won't spend the night at a hotel that costs less than min dollars per night. Write a function that determines the number of possible hotels you can stay at given a sorted list of their price per nights (pricePerNights). Use the following prototype(s) and create no global variables. For full credit the function needs to be O(log(N)). int getNumber(int min, int max, int * pricePerNights, int N)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started