Skip to main content

Salesforce Coding Interview Questions

100 Salesforce coding interview problems with full optimal solutions — 30 easy, 50 medium, 20 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an Salesforce interviewer values, and a FAQ section.

Showing 18 problems of 100

  • #4easysometimes asked

    4. Remove Duplicates from Sorted Array

    Remove duplicates from a sorted array in place and return the new length. Salesforce asks this to verify you can manage two pointers cleanly — they use the same pattern in their dedup logic for record imports.

  • #5easysometimes asked

    5. Remove Element

    Remove all occurrences of a value from an array in place. Salesforce uses this to test in-place array manipulation, the same pattern they use in their record-filtering pipelines.

  • #6easysometimes asked

    6. Search Insert Position

    Find the index to insert a target value into a sorted array. Salesforce uses this to test whether you implement binary search with the correct boundary semantics — the same pattern their SOQL ORDER-BY range queries depend on.

  • #7easyrarely asked

    7. Plus One

    Increment a number represented as an array of digits by one. Salesforce asks this to verify you handle carry propagation cleanly — a building block for their financial-precision arithmetic.

  • #9easysometimes asked

    9. Binary Tree Inorder Traversal

    Return the inorder traversal of a binary tree. Salesforce uses this to test both recursive and iterative tree traversal, since their org-hierarchy queries (e.g., role hierarchy) rely on tree walks.

  • #10easysometimes asked

    10. Same Tree

    Determine if two binary trees are identical in structure and value. Salesforce uses this to test recursive tree comparison, which underlies their metadata-diff and config-deployment pipelines.

  • #11easysometimes asked

    11. Symmetric Tree

    Determine if a binary tree is a mirror of itself around its center. Salesforce uses this to test mirrored recursion — the key insight that the recursive subproblem differs from the surface problem.

  • #13easysometimes asked

    13. Balanced Binary Tree

    Determine if a binary tree is height-balanced (every node's left and right subtree differ in height by at most 1). Salesforce uses this to test the bottom-up pattern that avoids the O(n^2) trap.

  • #14easysometimes asked

    14. Path Sum

    Determine if a binary tree has a root-to-leaf path summing to a target value. Salesforce uses this to test recursive path tracking, the foundation of their workflow-rule cascade evaluation.

  • #15easyrarely asked

    15. Pascal's Triangle

    Given numRows, return the first numRows of Pascal's triangle. Salesforce asks this to test row-by-row dynamic-programming style construction.

  • #17easysometimes asked

    17. Valid Palindrome

    Determine if a string is a palindrome considering only alphanumeric characters and ignoring case. Salesforce uses this to test two-pointer string manipulation with edge-case handling.

  • #22easysometimes asked

    22. Majority Element

    Find the element that appears more than n/2 times in an array. Salesforce asks this to test the Boyer-Moore voting algorithm, an O(1)-space trick that surprises most candidates.

  • #23easysometimes asked

    23. Rotate Array

    Rotate an array to the right by k steps. Salesforce uses this to test the three-reverse trick that achieves O(1) extra space.

  • #24easyrarely asked

    24. Reverse Bits

    Reverse the bits of a given 32-bit unsigned integer. Salesforce uses this to gauge whether candidates can comfortably reason about bit manipulation.

  • #25easysometimes asked

    25. Number of 1 Bits

    Count the number of set bits (1s) in a 32-bit unsigned integer. Salesforce uses this to test the Brian Kernighan bit-trick used internally in their permission-mask aggregation.

  • #27easyrarely asked

    27. Happy Number

    Determine if a number is 'happy' — repeatedly replace with sum of squares of its digits until it reaches 1 (happy) or cycles forever. Salesforce uses this to test cycle detection in a synthesized sequence.

  • #28easysometimes asked

    28. Isomorphic Strings

    Determine if two strings are isomorphic (bijective character mapping). Salesforce uses this to test bidirectional hash-map invariants — they grade on whether you check BOTH directions.

Related interview-prep guides

Interview Platforms

HireVue Tech Interview Guide: The 2026 Playbook for Async Video Rounds

HireVue is the category-leading async video interview platform. Candidates record answers solo, on the clock, and a combined AI-plus-human review layer scores the recording days later. For 2026 tech jobseekers, the format is different enough from live interviews to need its own playbook. This guide is that playbook.

Interview Platforms

Codility for Tech Interviews in 2026: The Complete Guide for Candidates

Codility is the dominant algorithmic-assessment platform across European tech hiring. Heavy in the UK, Germany, Netherlands, Nordics, and Poland where the company was founded. It scores candidates on both correctness and time complexity, runs 60-to-120-minute timed tests, and ships three products: Tests, CodeCheck, and CodeLive. This guide is what 2026 candidates need to know.

Interview Platforms

Spark Hire Async Video Interview Guide for Tech Jobseekers (2026)

Spark Hire is a mid-market async video interview platform used by 6,000+ employers across tech, healthcare, retail, and education. Candidates record video answers to pre-recorded prompts within configurable time budgets, and hiring teams review the recordings asynchronously. Lighter on AI scoring than HireVue, heavier on human review.

Salesforce Coding Interview Questions — Full Solutions — InterviewChamp.AI