1. Count of Smaller Numbers After Self
You are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i] is the number of smaller elements to the right of nums[i].
Example 1:
Input: nums = [5,2,6,1] Output: [2,1,1,0] Explanation: To the right of 5 there are 2 smaller elements (2 and 1). To the right of 2 there is only 1 smaller element (1). To the right of 6 there is 1 smaller element (1). To the right of 1 there is 0 smaller element.
Example 2:
Input: nums = [-1] Output: [0]
Example 3:
Input: nums = [-1,-1] Output: [0,0]
Constraints:
- 1 <= nums.length <= 105
- -104 <= nums[i] <= 104
2. Design a Java class to store and retrieve unique and valid emails from nested data structures.
Design a Java class to store and retrieve unique and valid emails from nested data structures. The input data will be in the form of a list with elements like {type: email, value: xxx@xx.com} and nested structures such as {type: contact, value: {type: email, value: xxx@xxx.com}}. Your task is to create a class that can handle this data and provide a function to return the first unique and valid email address.
3. Design a Frequency Cap System for an Ads Platform
Design a frequency cap system for an ads platform to limit the number of times an ad is shown to a user within a certain time frame to ensure a good user experience. Discuss the algorithms and technologies that could be used for rate limiting and ad impression aggregation.
4. Design a Topological Sorting Algorithm
Design a topological sorting algorithm for Netflix's video rendering system, where videos have dependencies on each other. Discuss edge cases and how the algorithm would handle them.
5. Schema Design for a Meta-like Product
In a schema design interview, you are asked to design the API and data relationships for a product similar to Meta. Discuss your design approach based on your work experience and the considerations you take into account when designing the schema.