Salesforce logo

Salesforce Software Engineer Coding Questions

31 practice questions for Salesforce Software Engineer interviews

Salesforce software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.

All Roles Software Engineer Backend Engineer Frontend Engineer Full Stack Engineer Mobile Engineer Data Engineer Data Scientist ML Engineer DevOps Engineer DevOps Engineer Product Manager SRE Security Engineer Engineering Manager Data Analyst UX/UI Designer QA Engineer

No verified questions yet for Salesforce.

coding Senior graph #1

1. [OA] Graph Traversal — Optimize Salesforce's lead qualification processing

Salesforce processes leads using a network of associated contacts. Implement a method to find the number of unique leads processing through a graph formed by contacts and their relationships.
Given a list of contacts represented as pairs of integers where each pair (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:
Input: contacts = [(1, 2), (2, 3), (3, 4)], start = 1
Output: 4
Explanation: Starting from contact 1, the visible unique contacts are 1, 2, 3, and 4.
Example 2:
Input: contacts = [(1, 2), (2, 3), (3, 4), (5, 6)], start = 5
Output: 2
Explanation: Starting from contact 5, only contacts 5 and 6 are reachable.
Constraints:
- 1 <= len(contacts) <= 10^5
- 1 <= contacts[i][0], contacts[i][1] <= 10^6
coding Hard sliding window #2

2. [OA] Sliding Window — Optimize Salesforce's API request handling

To improve the performance of API requests and reduce response times, Salesforce needs to implement an algorithm to handle bursts of requests within a specific time frame.
Given a list of int 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:
Input: timestamps = [1, 2, 3, 5, 6]
Output: 4
Explanation: The requests at times 1, 2, 3, and 5 can all be handled within a 5-second window (from time 1 to 6).
Example 2:
Input: timestamps = [1, 3, 6, 8, 10]
Output: 3
Explanation: The requests at times 6, 8, and 10 can all be handled within a 5-second window (from time 6 to 11).
Constraints:
- 1 <= len(timestamps) <= 10^5
- 0 <= windowSize <= 10^6
- 0 <= timestamps[i] <= 10^6

Related Salesforce Software Engineer interview prep

Start practicing Salesforce questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free