Salesforce Coding Interview Questions
These are the coding problems tagged as asked at Salesforce in interviews and online assessments reported by candidates. Use the list to see which topics repeat, then solve the problems in order of difficulty: basics first, then the intermediate and advanced ones.
Reported questions change over time and are not a guarantee of what you will be asked, so treat them as a map of the patterns Salesforce tends to test rather than a list to memorise. For each problem, practise explaining your approach, its time and space cost and the edge cases before you write the code.
Coding problems
- Two Sum (Basic)
- Best Time to Buy and Sell Stock (Basic)
- Maximum Subarray (Intermediate)
- Valid Parentheses (Basic)
- Longest Substring Without Repeats (Intermediate)
- Product of Array Except Self (Intermediate)
- Coin Change (Intermediate)
- Longest Increasing Subsequence (Advanced)
- Valid Palindrome (Basic)
- Kth Largest Element (Intermediate)
- Missing Number (Basic)
- Subarray Sum Equals K (Intermediate)
- Container With Most Water (Intermediate)
- Trapping Rain Water (Advanced)
- Longest Palindromic Substring (Intermediate)
- Sort Colors (Basic)
- Find Pivot Index (Basic)
- Largest Rectangle in Histogram (Advanced)
- Integer to Roman (Intermediate)
- Roman to Integer (Intermediate)
- Longest Common Subsequence (Advanced)
- Coin Change Ways (Advanced)
- Search in a Rotated Sorted Array (Advanced)
- Merge Intervals (Intermediate)
- Sort Characters by Frequency (Intermediate)
- Candy Distribution (Advanced)
- Maximum Units on a Truck (Intermediate)
- Last Stone Weight (Intermediate)
- Valid Parenthesis With Wildcards (Advanced)
- Permutation Inside a String (Intermediate)
- Subarrays With Product Less Than K (Intermediate)
- Maximum Product of Three (Basic)
- Zigzag Conversion (Intermediate)
- Count Palindromic Substrings (Intermediate)
- Find K Closest Elements (Intermediate)
- Minimum Edge Reversals Per Node (Intermediate)
- Shortest Bridge Between Two Islands (Intermediate)
- Tree Nodes at Distance K (Advanced)
- Tree Diameter (Advanced)
- Maximum Product Subarray (Intermediate)
- Subarray Sum Equals K (Intermediate)
- Coin Change Ways (Intermediate)
- Partition Equal Subset Sum (Intermediate)
- House Robber II (Intermediate)
- Gas Station (Intermediate)
- Container With Most Water (Intermediate)
- Top K Frequent Values (Intermediate)
- Minimum Window Substring (Advanced)
- Number of Digit One (Advanced)
- Course Schedule Feasible (Intermediate)
- Network Delay Time (Advanced)
- Running Kth Largest (Intermediate)
- Tree Vertical Traversal (Intermediate)
- LRU Cache Operations (Basic)
- LFU Cache Operations (Intermediate)
- Median of Sliding Windows (Intermediate)
- Reconstruct Itinerary (Advanced)
- Find Duplicate Subtrees (Basic)
- Maximum Path Quality (Basic)
- Count Subarrays With Median K (Basic)
- Merge Two Sorted Lists (Basic)
- Validate Binary Search Tree (Intermediate)
- Binary Tree Maximum Path Sum (Advanced)
- Boundary of Binary Tree (Advanced)
- Sum of Nodes With Even-Valued Grandparent (Basic)
- Find Leaves of Binary Tree (Intermediate)
- Number of Islands (Basic)
- Rotting Oranges (Intermediate)
- Course Schedule Order (Intermediate)
- Swim in Rising Water (Advanced)
- Operations to Make Network Connected (Intermediate)
- Burst Balloons (Advanced)
- Maximal Square (Intermediate)
- Strange Printer (Advanced)
- Minimum Difficulty of a Job Schedule (Advanced)
- Delete and Earn (Intermediate)
- Longest Increasing Path in a Matrix (Advanced)
- String Compression (Basic)
- Word Search (Intermediate)
- Count Binary Substrings (Basic)
Related
- Company interview roadmaps
- Practice coding problems online
- System design interview questions
- SDE-2 interview preparation
- All interview question topics
Frequently asked questions
How should I use the Salesforce problem list?
Sort by the topics you are weakest in, solve a problem under a timer, then read the explanation. Repeat until the patterns feel familiar, and finish with a mock interview.
Are these the exact Salesforce interview questions?
They are problems candidates reported being asked. Companies rotate questions, so use them to learn the patterns, not to predict the exact question.