Algorithm · Uber · Medium
You are inside a building that has n floors, starting from the ground floor (floor 0). To get to floor n, you must decide how many floors to ride the elevator. For a chosen split point k, you take the elevator for the first k floors and then walk the stairs for the remaining n - k floors. Four integer parameters govern the cost: e1, t1, e2, and c. Riding k floors with the elevator consumes k * e1 units of energy and takes k * t1 units of time. After leaving the elevator,…
Checking your access…