Salesforce DS & Algo Round Interview Questions Asked in 2026
Salesforce Interview Preparation

Salesforce DS & Algo Round Interview Questions Asked in 2026

DS & Algo questions for this list have been picked from Salesforce interview experiences shared on forums/blogs etc in 2026. Use this list for final preparation of your Salesforce interview rounds.

Salesforce hires for Member of Technical Staff i.e. MTS/SMTS/LMTS positions. MTS role is around 3 years experience. LLD rounds may be there for MTS role as well.

Complete list of Salesforce DS and Algo round questions:

https://codezym.com/lld/salesforce-dsa

If you are looking for Salesforce low level design round questions, then you can find them here:

https://codezym.com/lld/salesforce

LeetCode Questions

Below is list of questions you can directly find on LeetCode (free ones):

Below are other questions, these include followups asked during interview rounds.
1

Good Ways to Split an Array in 3 Contiguous Parts

You are given a List<Integer> nums containing non-negative integers. Split the list into three non-empty contiguous parts: A1, A2, and A3.

Let:

S1 be the sum of elements in A1

S2 be the sum of elements in A2

S3 be the sum of elements in A3

Count how many splits are valid such that:

S2 ≤ S1 + S3

https://codezym.com/question/248-good-ways-to-split-array
2

ATM Queue Leaving Order

There are n people standing in an ATM queue, numbered from 1 to n. Initially, they stand in increasing order of their number.

Person i wants to withdraw amounts[i - 1] units of money. In one turn, a person can withdraw at most maxWithdraw units.

If a person still needs more money after their turn, they go to the end of the queue. Otherwise, they leave the queue.

Return the order in which all people leave the queue.

https://codezym.com/question/249-atm-queue-leaving-order
3

Minimum Knight Moves on Infinite Chessboard

A knight is placed at coordinate [0, 0] on an infinite chessboard. The board has no boundary, so coordinates may be positive or negative.

In a single move, the knight travels two squares along one axis and one square along the other axis. Given a target coordinate [x, y], return the fewest moves needed for the knight to reach that target.

https://codezym.com/question/250-min-knight-moves-chess
4

Serialize Nearly Sorted Stream of Numbers

You are given a stream of numbers and an integer bufferSize. Every number is at most bufferSize positions away from where it should appear in the correctly ordered stream.

Return the numbers in sorted order, meaning the final list should be in non-decreasing order.

If two numbers are equal, keep their relative order from the input stream to make the output deterministic.

https://codezym.com/question/251-serialize-nearly-sorted-stream
5

Minimum Meeting Rooms Required

You are given a list of meeting time intervals.

Each interval is provided as a string in the format "start,end", where start is the meeting start time and end is the meeting end time. You need to split each interval string and extract the integer values start and end.

Each interval is half-open, represented as [start, end). This means a meeting ending at time x does not overlap with another meeting starting at time x. For example, [1, 3) does not overlap with [3, 5).

Your task is to determine the minimum number of meeting rooms required so that no two overlapping meetings are placed in the same meeting room.

https://codezym.com/question/179-minimum-meeting-rooms-required
6

Rotting Oranges With Different Connection Times

You are given a grid of oranges and a list of connection times between adjacent cells. Each cell contains one of the following values:

0: an empty cell

1: a fresh orange

2: a rotten orange

A rotten orange can make a connected fresh orange rotten, but each connection may take a different amount of time. A connection is given as "row1,col1,row2,col2,time", meaning the cell at [row1, col1] and the cell at [row2, col2] are connected, and rotting can spread across this connection in time minutes.

Since different connections may take different amounts of time, rotting should always use the earliest possible time at which each orange can become rotten.

Return the minimum time needed for all fresh oranges to become rotten.

https://codezym.com/question/252-rotting-oranges-weighted
7

Count Ways to Split String Into Prime Numbers

You are given a string s that represents a positive integer. Count the number of ways to split s into one or more prime numbers.

The digits must remain in the same order, and every digit of s must be used exactly once. Each split part must represent a prime number.

A prime number is an integer greater than 1 that has exactly two positive divisors: 1 and itself.

https://codezym.com/question/253-count-ways-to-split-to-prime-numbers
8

Token Bucket Resource Allocation

You are given a token bucket with a fixed number of tokens. Users can request tokens from the bucket. A request is granted only when enough tokens are currently available.

When a request is granted, that user holds those tokens for exactly 1 hour. After 1 hour, the tokens expire automatically and return to the bucket.

A user may also manually release all currently active tokens held by them before expiry. Expired tokens must be cleaned up before processing every method call.

https://codezym.com/question/255-token-bucket-resource-allocation
9

Maximum Requests in Continuous Time Window

You are given a list timestamp, where each value represents the minute at which one request occurred. You are also given an integer windowSize. Return the maximum number of requests that can be found inside any continuous time window of length windowSize minutes.

The timestamps may be given in any order. The method should count requests based on their time values, not their original positions.

https://codezym.com/question/256-max-requests-continuous-time-window
10

Minimum Time Task Scheduling with Constraints

You are given a list of task types, a list of memory required by each task, and a server memory limit. Each task takes exactly 1 unit of time to complete.

In one unit of time, multiple tasks can run together if they satisfy both constraints: at most 2 tasks of the same type can run in parallel, and the total memory of all running tasks must not exceed the server memory limit.

Return the minimum time required to execute all tasks.

https://codezym.com/question/258-min-time-task-scheduling
11

Grid With K Jumps Minimum Steps

You are given an m x n grid. Each cell is either empty or blocked by an obstacle. From any empty cell, you may move in one of four directions: left, right, up, or down.

In one step, you may jump from 1 to k cells in the chosen direction. Every cell crossed during the jump, including the landing cell, must be inside the grid and must not be an obstacle.

Return the minimum number of steps required to reach the destination cell from the source cell. If the destination cannot be reached, return -1.

https://codezym.com/question/259-grid-with-k-jumps
12

Count Number of Distinct Islands in Grid

You are given a non-empty grid containing only 0 and 1.

Each 1 represents land, and each 0 represents water.

An island is a connected group of land cells. Two land cells are connected if they share a side horizontally or vertically.

You may assume that all four outer edges of the grid are surrounded by water.

Your task is to count how many distinct island shapes exist in the grid.

Two islands are considered the same only if one island can be shifted up, down, left, or right to exactly match the other island.

Rotating or reflecting an island is not allowed when comparing island shapes.

https://codezym.com/question/190-count-distinct-islands-grid
13

Bottle Recycling Perk Maximization

You are given an initial number of bottles and an initial amount of money. You may either recycle bottles to earn money or spend bottles and money to buy perks.

Recycling one bottle gives recycleVal dollars. Buying one perk costs exactly 1 bottle and perkVal dollars.

Each bottle can be used at most once. A bottle that is recycled cannot be used to buy a perk, and a bottle used to buy a perk cannot be recycled. Return the maximum number of perks that can be obtained.

https://codezym.com/question/260-bottle-recycling-perk-maximization
14

Maximum Number of Non-Overlapping Palindromic Substrings

You are given a string s and an integer k. Choose the maximum possible number of non-overlapping substrings such that every chosen substring is a palindrome and has length at least k.

A palindrome is a string that reads the same from left to right and from right to left.

The chosen substrings do not need to cover the entire string. Characters between chosen substrings and any remaining characters may be ignored.

Return the chosen palindromic substrings as a List<String>. The substrings must be returned in the same left-to-right order in which they appear in s.

https://codezym.com/question/261-max-non-overlapping-palindromes
15

Count Special Subarrays With Odd Divisors

You are given a list of positive integers called nums. A contiguous subarray is considered special when the product of all its elements has an odd number of positive divisors.

Return the total number of special subarrays in nums.

https://codezym.com/question/262-count-special-subarrays
16

Maximum Length Subsequence Substring

You are given two strings, x and y. Return the longest string that is both a subsequence of x and a contiguous substring of y.

A subsequence is formed by deleting zero or more characters without changing the order of the remaining characters. A substring consists of consecutive characters.

If multiple valid strings have the maximum length, return the lexicographically smallest one. If no non-empty valid string exists, return an empty string.

https://codezym.com/question/263-max-length-subseq-substring
17

IPO Share Allocation With Bids

You are given a collection of bids for shares in an IPO and the total number of shares available. Allocate the shares according to bid price and submission time, then return the user IDs of bidders who receive no shares.

https://codezym.com/question/264-ipo-share-allocation-with-bids
18

Purchase Maximum Number of Consecutive Products

You are given a list of product prices sorted in non-decreasing order and a list of buying queries. For each query, determine the maximum number of consecutive products that can be purchased without exceeding the given budget.

https://codezym.com/question/265-purchase-max-consecutive-products
19

Complete Weekly Work Hours

A worker's daily hours for one week are represented by a seven-character string workHours. Each position corresponds to one day and contains either a digit from 0 to 9 or the character #.

Replace every # with a digit from 0 to 9 so that the sum of all seven digits is exactly requiredHours. Return all completed strings that satisfy this condition.

https://codezym.com/question/267-complete-weekly-work-hours