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. Bag-of-Words and Cosine Similarity
Compute bag-of-words representations for two documents and compute the cosine similarity between the two vectors. Assume the vocabulary consists of all unique words present in either document. The bag-of-words vector representation for a document should contain a 1 if a word is present in the document one or more times, and a 0 otherwise.
3. Contact Tracing System Design
Design a contact tracing system similar to those used during the COVID-19 pandemic. The system should (1) maintain a 2-week rolling log of encounters on mobile devices, and (2) use a breadth-first search (BFS) algorithm to trace contacts when a user reports a COVID infection, leveraging Cassandra for log storage.
4. Commerce Model for Video Content
Design a commerce model that facilitates (1) purchasing access to download videos and (2) subscribing to a video creator's content.
5. Shortest Path Algorithm
Write an algorithm that determines the shortest path from point 'a' to point 'b' in the warehouse, and returns this path as an array.