Problem Link:- CodeChef: Practical coding for everyone

1.Difficulty - Easy.
2. Prerequisites - Observing the logic of issuing room to guests according to their arrival and departure day.
3.Explanation -
This question takes three array inputs, namely the price of K rooms, arrival, and departure day of N guests.
According to the question, we want the minimum amount required. Hence sorting the room_price array will provide us the lowest amount for a room at the beginning of the array and the highest amount at the end. While issuing rooms, we will concentrate on issuing the room having the lowest booking fee.
Sorting the arvl_day and deprt_day will make it easy for the counting.
So basically, we are concentrate on, for each day how many guests in total are staying in the rooms for the night. To find this we have to count each day arriving and each day departure. The cumulative addition of the total guests each night will provide us how much cost it is going to be at a minimum.
We are defining two other arrays to do three other works.
1.arvl_count - this counts exactly how many people arriving in the hotel for one day.
2.deprt_count - this counts exactly how many people leaving the hotel in one day.
Now the value of (arvl_count - deprt_count) for a day will give us the total number of guests staying in the hotel for one day and that can be used to calculate one day fare for the hotel rooms.
Adding those cumulatively, “opt” can calculate the total guest on one night for the 5 nights and “sum” can calculate the total fare for 5 days.