Salesforce software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.
No verified questions yet for Salesforce.
(a, b) indicates a connection between contacts a and b, your task is to find the total number of distinct leads reachable from a given starting contact.Method Signature:def countUniqueLeads(contacts: List[Tuple[int, int]], start: int) -> int:Example 1:contacts = [(1, 2), (2, 3), (3, 4)], start = 14contacts = [(1, 2), (2, 3), (3, 4), (5, 6)], start = 521 <= len(contacts) <= 10^51 <= contacts[i][0], contacts[i][1] <= 10^6int timestamps representing the arrival times of API requests and an integer windowSize, your task is to determine the maximum number of API requests that can be handled within any windowSize seconds.Method Signature:def maxRequestsWithinWindow(timestamps: List[int], windowSize: int) -> int:Example 1:timestamps = [1, 2, 3, 5, 6]4timestamps = [1, 3, 6, 8, 10]31 <= len(timestamps) <= 10^50 <= windowSize <= 10^60 <= timestamps[i] <= 10^6Sign up for free to access walkthroughs, AI-generated questions, and more.
Get Started Free