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 28 problems of 100

  • #33mediumsometimes asked

    33. Longest Palindromic Substring

    Return the longest palindromic substring in s. Salesforce uses this to test the expand-around-center pattern — they expect a clean O(n^2) solution.

  • #34mediumsometimes asked

    34. Container With Most Water

    Find two lines that, with the x-axis, form a container holding the most water. Salesforce uses this to test the converging two-pointer pattern with an optimality argument.

  • #38mediumsometimes asked

    38. Generate Parentheses

    Given n pairs of parentheses, generate all combinations of well-formed parentheses. Salesforce uses this as a constrained-backtracking problem.

  • #39mediumrarely asked

    39. Swap Nodes in Pairs

    Swap every two adjacent nodes in a linked list. Salesforce uses this to test pointer dexterity — they want clean iterative code without value swaps.

  • #40mediumrarely asked

    40. Next Permutation

    Compute the next lexicographic permutation of an array in place. Salesforce uses this to test in-place array manipulation with a non-obvious algorithm.

  • #43mediumsometimes asked

    43. Valid Sudoku

    Validate a Sudoku board's rows, columns, and 3x3 sub-boxes. Salesforce uses this to test multi-dimensional validation in a single pass.

  • #44mediumsometimes asked

    44. Combination Sum

    Find all unique combinations of candidates that sum to target (candidates can be reused). Salesforce uses this as the canonical backtracking-with-reuse problem.

  • #46mediumsometimes asked

    46. Rotate Image

    Rotate an n x n 2D matrix 90 degrees clockwise in place. Salesforce uses this to test the transpose-then-reverse trick that avoids the layer-by-layer approach.

  • #49mediumsometimes asked

    49. Spiral Matrix

    Return all elements of a matrix in spiral order. Salesforce uses this to test boundary tracking and clean iteration when corners get tricky.

  • #50mediumsometimes asked

    50. Jump Game

    Determine if you can reach the last index of an array where each element is the max jump distance. Salesforce uses this as the canonical greedy problem.

  • #52mediumsometimes asked

    52. Unique Paths

    Count unique paths in an m x n grid moving only right or down. Salesforce uses this as a canonical 2D DP problem.

  • #53mediumsometimes asked

    53. Minimum Path Sum

    Find the path from top-left to bottom-right of a grid with minimum sum. Salesforce uses this to test 2D DP with grid traversal.

  • #54mediumrarely asked

    54. Simplify Path

    Convert a Unix-style file path to its canonical form. Salesforce uses this to test stack-based string processing — analogous to their record-hierarchy canonicalization.

  • #55mediumsometimes asked

    55. Edit Distance

    Compute the minimum number of insertions, deletions, or substitutions to transform one string into another. Salesforce uses this as the canonical 2D DP problem with three-way transitions.

  • #56mediumsometimes asked

    56. Set Matrix Zeroes

    Set entire rows and columns to zero where a zero exists in the matrix. Salesforce uses this to test in-place algorithms with O(1) space.

  • #57mediumsometimes asked

    57. Search a 2D Matrix

    Search for a target in a row-wise and column-wise sorted matrix where each row's first is greater than the previous row's last. Salesforce uses this to test treating a 2D matrix as a 1D sorted array for binary search.

  • #58mediumsometimes asked

    58. Sort Colors

    Sort an array of 0s, 1s, and 2s in-place. Salesforce uses this to test the Dutch National Flag (DNF) three-way partitioning algorithm.

  • #59mediumsometimes asked

    59. Combinations

    Return all possible combinations of k numbers chosen from 1..n. Salesforce uses this as a backtracking template — relevant to their permission-set selection logic.

  • #61mediumsometimes asked

    61. Word Search

    Determine if a word can be found in a 2D grid via adjacent cells (no revisits). Salesforce uses this to test DFS with backtracking and visited state.

  • #62mediumsometimes asked

    62. Decode Ways

    Count the number of ways to decode a string of digits (1-26 → A-Z). Salesforce uses this to test DP with conditional transitions.

  • #69mediumsometimes asked

    69. Find Peak Element

    Find any peak (local maximum) in an array in O(log n). Salesforce uses this to test binary search on a non-monotonic predicate.

  • #77mediumsometimes asked

    77. Word Pattern

    Determine if a string follows the same pattern as a sequence of words. Salesforce uses this to test bidirectional hashmap invariants in a more complex setting.

  • #80mediumsometimes asked

    80. Insert Delete GetRandom O(1)

    Design a data structure supporting insert, delete, and getRandom all in O(1). Salesforce uses this as the canonical 'when do you need both array and map' problem.

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