| שאלות מתוך הראיון |
**1. Amazon EC2**
There are **n** VM types, each with a limited number of instances. For every rental, the customer pays:
**lowest non-zero availability + highest availability**
among all VM types. **m** customers arrive sequentially, each renting from the VM type with the highest availability. After each rental, that VM type's availability decreases by 1. Compute the total revenue after all rentals.
**Code Question 2**
Amazon's search engine returns products as **[productName, starRating, priceInCents]**. Given a sort column (0=name, 1=rating, 2=price), sort direction (0=ascending, 1=descending), page size, and 0-indexed page number, return the product names on that page. Preserve the original order when values are equal. Treat **starRating** and **priceInCents** as integers when sorting; only **productName** is sorted lexicographically. |
|