31 practice questions for Salesforce Mobile Engineer interviews
Salesforce mobile engineer interviews focus on iOS or Android platform knowledge, memory management, offline-first architecture, and mobile-specific system design.
1. [OA] LRU Cache — Implement the caching layer Salesforce uses for its mobile API responses
Salesforce aims to optimize mobile application performance by implementing a caching mechanism to store frequently accessed API responses. This problem requires you to design and implement a Least Recently Used (LRU) cache.Function Signature: python class LRUCache: def __init__(self, capacity: int): def get(self, key: int) -> int: def put(self, key: int, value: int) -> None: Example 1: Input: LRUCache(2) followed by put(1, 1), put(2, 2), get(1), put(3, 3), get(2), put(4, 4), get(1), get(3), get(4) Output: [-1, 1, -1, 3, 4] Explanation: Cache evicts key 2 as it is the least recently used when key 3 is added.Constraints: - The capacity of the cache is a positive integer 1 <= capacity <= 3000. - All operations will be called with valid keys and values within the constraints.
codingHardsliding window#2
2. [OA] Sliding Window — Implement a mobile-first user activity tracking algorithm for Salesforce
In mobile applications, tracking user activities efficiently is crucial for enhancing user engagement and improving app features. This problem will require you to implement a sliding window approach to help Salesforce analyze user behavior in real-time.Given a list of user activities represented as timestamps in seconds (e.g., activity[]), your task is to calculate the number of unique user activities in the last k seconds at any point in time.Function Signature: python def count_unique_activities(activity: List[int], k: int) -> List[int]: Example 1: Input: activity = [1, 2, 1, 3, 2, 3, 5], k = 3 Output: [1, 2, 3, 3, 2, 2] Explanation: For each second, we count unique activities in the last 3 seconds.Example 2: Input: activity = [1, 2, 3, 4, 5], k = 2 Output: [1, 2, 3, 4, 5] Explanation: There are always unique activities since k is small enough.Constraints: - The length of activity will be at most 10^5. - Each timestamp is a positive integer and will not exceed 10^6. - k will not exceed 10^5.