https://github.com/allaboutjst/airbnb/blob/master/README.md
https://www.glassdoor.com/Interview/Provide-a-set-of-positive-integers-an-array-of-integers-Each-integer-represent-number-of-nights-user-request-on-Airbnb-QTN_939288.htm
Given a set of numbers in an array which represent number of consecutive nights of AirBnB reservation requested, as a host, pick the sequence which maximizes the number of days of occupancy, at the same time, leaving at least 1 day gap in between bookings for cleaning. Problem reduces to finding max-sum of non-consecutive array elements.
public int rob(int[] nums) {
if (nums == null) return 0;
int n = nums.length;
if (n == 0) return 0;
if (n == 1) return nums[0];
int f1 = nums[0]; // max sof far, excluding current
int f2 = Math.max(nums[0], nums[1]); // max so far
for (int i = 2; i < n; i++) {
int f = Math.max(f1 + nums[i], f2);
f1 = f2;
f2 = f;
}
return f2;
}
https://www.glassdoor.com/Interview/Provide-a-set-of-positive-integers-an-array-of-integers-Each-integer-represent-number-of-nights-user-request-on-Airbnb-QTN_939288.htm