Salesforce logo SA
Verified Company Vault 30d Active

Salesforce DSA Interview Questions

187 curated coding interview questions directly asked in Salesforce technical rounds, sorted by frequency with recency and difficulty diagnostics.

187 Total Questions
27 (14%) Easy Problems
111 (59%) Medium Problems
49 (26%) Hard Problems
🔥 Most Tested Topics:
Arrays (66)Core DSA (47)Strings (39)Trees (29)Dynamic Programming (13)
📂 Sourced Datasets:
Last 30 daysLast 3 monthsLast 6 monthsAll questionsOlder than 6 months
Showing 187 of 187 displayed
IDProblemDifficultyTopicPatternAcceptanceFrequencyRecency
2380Time Needed to Rearrange a Binary StringMediumStringsHashing / Sliding Window53.0%100.0%30d
2571Minimum Operations to Reduce an Integer to 0MediumArraysSorting / Prefix / Scan62.4%100.0%30d
3035Maximum Palindromes After OperationsMediumArrays; StringsSorting / Prefix / Scan; Hashing / Sliding Window46.5%100.0%3m
3634Minimum Removals to Balance ArrayMediumArraysSorting / Prefix / Scan47.9%75.0%3m
460LFU CacheHardDesignData Structure Design49.2%75.0%3m
713Subarray Product Less Than KMediumArraysSorting / Prefix / Scan54.3%75.0%all
2957Remove Adjacent Almost-Equal CharactersMediumStringsHashing / Sliding Window53.7%75.0%all
3398Smallest Substring With Identical Characters IHardStrings; TreesHashing / Sliding Window; DFS / BFS20.6%75.0%all
3399Smallest Substring With Identical Characters IIHardStrings; TreesHashing / Sliding Window; DFS / BFS40.3%75.0%all
3488Closest Equal Element QueriesMediumCore DSAImplementation / Reasoning51.4%75.0%all
443String CompressionMediumStringsHashing / Sliding Window60.0%62.5%3m
664Strange PrinterHardCore DSAImplementation / Reasoning60.9%62.5%3m
628Maximum Product of Three NumbersEasyArraysSorting / Prefix / Scan45.9%62.5%3m
210Course Schedule IIMediumGraphsBFS / DFS / Topological Sort55.5%62.5%3m
146LRU CacheMediumDesignData Structure Design47.4%62.5%6m
994Rotting OrangesMediumCore DSAImplementation / Reasoning58.7%62.5%6m
1219Path with Maximum GoldMediumArraysSorting / Prefix / Scan68.4%62.5%6m
2603Collect Coins in a TreeHardTrees; Dynamic ProgrammingDFS / BFS; State Transition40.1%62.5%6m
56Merge IntervalsMediumArraysSorting / Prefix / Scan51.8%62.5%all
115Distinct SubsequencesHardCore DSAImplementation / Reasoning51.9%62.5%all
124Binary Tree Maximum Path SumHardArrays; TreesSorting / Prefix / Scan; DFS / BFS42.3%62.5%all
2068Check Whether Two Strings are Almost EquivalentEasyStringsHashing / Sliding Window64.3%62.5%all
200Number of IslandsMediumGraphsBFS / DFS / Topological Sort64.4%62.5%all
647Palindromic SubstringsMediumStrings; TreesHashing / Sliding Window; DFS / BFS72.8%62.5%all
2563Count the Number of Fair PairsMediumCore DSAImplementation / Reasoning52.7%62.5%all
895Maximum Frequency StackHardArrays; Stack / QueueSorting / Prefix / Scan; Monotonic Stack / Simulation66.8%62.5%all
2866Beautiful Towers IIMediumCore DSAImplementation / Reasoning36.5%62.5%all
2865Beautiful Towers IMediumCore DSAImplementation / Reasoning44.5%62.5%all
1150Check If a Number Is Majority Element in a Sorted ArrayEasyArraysSorting / Prefix / Scan59.9%62.5%all
1051Height CheckerEasyCore DSAImplementation / Reasoning81.7%62.5%all
2946Matrix Similarity After Cyclic ShiftsEasyArraysSorting / Prefix / Scan74.3%62.5%all
2992Number of Self-Divisible PermutationsMediumBacktrackingBacktracking71.9%62.5%all
3125Maximum Number That Makes Result of Bitwise AND ZeroMediumArraysSorting / Prefix / Scan69.9%62.5%all
3171Find Subarray With Bitwise OR Closest to KHardArraysSorting / Prefix / Scan31.1%62.5%all
3135Equalize Strings by Adding or Removing Characters at EndsMediumStringsHashing / Sliding Window56.4%62.5%all
1268Search Suggestions SystemMediumBinary SearchBinary Search65.2%62.5%all
3193Count the Number of InversionsHardCore DSAImplementation / Reasoning30.5%62.5%all
3197Find the Minimum Area to Cover All Ones IIHardArraysSorting / Prefix / Scan63.5%62.5%all
3195Find the Minimum Area to Cover All Ones IMediumArraysSorting / Prefix / Scan78.2%62.5%all
3200Maximum Height of a TriangleEasyArraysSorting / Prefix / Scan44.4%62.5%all
1326Minimum Number of Taps to Open to Water a GardenHardArraysSorting / Prefix / Scan51.0%62.5%all
1659Maximize Grid HappinessHardCore DSAImplementation / Reasoning41.0%62.5%all
1701Average Waiting TimeMediumCore DSAImplementation / Reasoning73.1%62.5%all
924Minimize Malware SpreadHardCore DSAImplementation / Reasoning43.2%62.5%all
3313Find the Last Marked Nodes in TreeHardTreesDFS / BFS56.5%62.5%all
1297Maximum Number of Occurrences of a SubstringMediumArrays; Strings; TreesSorting / Prefix / Scan; Hashing / Sliding Window; DFS / BFS54.5%62.5%all
1221Split a String in Balanced StringsEasyStringsHashing / Sliding Window87.4%62.5%all
1143Longest Common SubsequenceMediumCore DSAImplementation / Reasoning59.2%62.5%all
3540Minimum Time to Visit All HousesMediumArraysSorting / Prefix / Scan69.2%62.5%all
3607Power Grid MaintenanceMediumCore DSAImplementation / Reasoning56.2%62.5%all
3613Minimize Maximum Component CostMediumArrays; GraphsSorting / Prefix / Scan; BFS / DFS / Topological Sort43.5%62.5%all
740Delete and EarnMediumCore DSAImplementation / Reasoning57.2%62.5%all
3Longest Substring Without Repeating CharactersMediumStrings; TreesHashing / Sliding Window; DFS / BFS; Sliding Window39.1%50.0%6m
213House Robber IIMediumDynamic ProgrammingState Transition44.9%50.0%6m
1522Diameter of N-Ary TreeMediumTreesDFS / BFS75.5%50.0%6m
934Shortest BridgeMediumCore DSAImplementation / Reasoning59.5%50.0%6m
6Zigzag ConversionMediumCore DSAImplementation / Reasoning54.2%50.0%6m
1839Longest Substring Of All Vowels in OrderMediumStrings; TreesHashing / Sliding Window; DFS / BFS; Sliding Window51.8%50.0%6m
207Course ScheduleMediumGraphsBFS / DFS / Topological Sort51.4%50.0%6m
105Construct Binary Tree from Preorder and Inorder TraversalMediumTreesDFS / BFS68.8%50.0%6m
355Design TwitterMediumDesignData Structure Design44.7%50.0%6m
2534Time Taken to Cross the DoorHardCore DSAImplementation / Reasoning50.3%50.0%6m
25Reverse Nodes in k-GroupHardTrees; Linked ListDFS / BFS; Two Pointers66.1%50.0%6m
992Subarrays with K Different IntegersHardArraysSorting / Prefix / Scan68.1%50.0%6m
22Generate ParenthesesMediumStringsHashing / Sliding Window78.7%50.0%6m
49Group AnagramsMediumStringsHashing / Sliding Window72.6%50.0%6m
5Longest Palindromic SubstringMediumStrings; TreesHashing / Sliding Window; DFS / BFS37.8%50.0%all
11Container With Most WaterMediumCore DSATwo Pointers60.0%50.0%all
42Trapping Rain WaterHardCore DSATwo Pointers67.4%50.0%all
76Minimum Window SubstringHardArrays; Strings; TreesSorting / Prefix / Scan; Hashing / Sliding Window; DFS / BFS; Sliding Window47.5%50.0%all
121Best Time to Buy and Sell StockEasyCore DSAImplementation / Reasoning56.8%50.0%all
155Min StackMediumStack / QueueMonotonic Stack / Simulation58.2%50.0%all
215Kth Largest Element in an ArrayMediumArrays; HeapSorting / Prefix / Scan; Priority Queue68.9%50.0%all
347Top K Frequent ElementsMediumHeapPriority Queue66.4%50.0%all
2484Count Palindromic SubsequencesHardCore DSAImplementation / Reasoning41.2%50.0%all
735Asteroid CollisionMediumCore DSAImplementation / Reasoning47.9%50.0%all
1315Sum of Nodes with Even-Valued GrandparentMediumArrays; Trees; Dynamic ProgrammingSorting / Prefix / Scan; DFS / BFS; State Transition85.9%50.0%all
2966Divide Array Into Arrays With Max DifferenceMediumArraysSorting / Prefix / Scan79.0%50.0%all
233Number of Digit OneHardCore DSAImplementation / Reasoning38.7%50.0%all
1Two SumEasyArraysSorting / Prefix / Scan; Two Pointers57.5%50.0%all
1710Maximum Units on a TruckEasyArraysSorting / Prefix / Scan74.9%50.0%all
2964Number of Divisible Triplet SumsMediumArraysSorting / Prefix / Scan67.6%50.0%all
79Word SearchMediumStrings; Binary SearchHashing / Sliding Window; Binary Search47.4%50.0%all
532K-diff Pairs in an ArrayMediumArraysSorting / Prefix / Scan45.9%50.0%all
863All Nodes Distance K in Binary TreeMediumTreesDFS / BFS67.7%50.0%all
875Koko Eating BananasMediumBinary SearchBinary Search50.0%50.0%all
2488Count Subarrays With Median KHardArrays; HeapSorting / Prefix / Scan; Priority Queue48.8%50.0%all
3295Report Spam MessageMediumCore DSAImplementation / Reasoning48.7%50.0%all
153SumMediumArraysSorting / Prefix / Scan39.1%37.5%all
20Valid ParenthesesEasyStringsHashing / Sliding Window44.2%37.5%all
23Merge k Sorted ListsHardArrays; Linked List; HeapSorting / Prefix / Scan; Two Pointers; Priority Queue59.6%37.5%all
33Search in Rotated Sorted ArrayMediumArrays; Binary SearchSorting / Prefix / Scan; Binary Search44.9%37.5%all
41First Missing PositiveHardArraysSorting / Prefix / Scan42.9%37.5%all
75Sort ColorsMediumArraysSorting / Prefix / Scan69.6%37.5%all
98Validate Binary Search TreeMediumStrings; Trees; Binary SearchHashing / Sliding Window; DFS / BFS; Binary Search35.8%37.5%all
139Word BreakMediumStrings; Dynamic ProgrammingHashing / Sliding Window; State Transition49.5%37.5%all
253Meeting Rooms IIMediumGreedyGreedy52.7%37.5%all
295Find Median from Data StreamHardHeapPriority Queue54.5%37.5%all
322Coin ChangeMediumDynamic ProgrammingState Transition48.4%37.5%all
394Decode StringMediumStrings; Dynamic Programming; Stack / QueueHashing / Sliding Window; State Transition; Monotonic Stack / Simulation62.6%37.5%all
696Count Binary SubstringsEasyStrings; TreesHashing / Sliding Window; DFS / BFS70.4%37.5%all
127Word LadderHardStringsHashing / Sliding Window45.6%37.5%all
1552Magnetic Force Between Two BallsMediumCore DSAImplementation / Reasoning72.1%37.5%all
2231Largest Number After Digit Swaps by ParityEasyCore DSAImplementation / Reasoning65.4%37.5%all
53Maximum SubarrayMediumArraysSorting / Prefix / Scan53.3%37.5%all
692Top K Frequent WordsMediumStrings; HeapHashing / Sliding Window; Priority Queue60.2%37.5%all
255Verify Preorder Sequence in Binary Search TreeMediumTrees; Binary SearchDFS / BFS; Binary Search51.8%37.5%all
329Longest Increasing Path in a MatrixHardArrays; Dynamic ProgrammingSorting / Prefix / Scan; State Transition56.6%37.5%all
366Find Leaves of Binary TreeMediumTreesDFS / BFS81.3%37.5%all
1200Minimum Absolute DifferenceEasyArraysSorting / Prefix / Scan75.1%37.5%all
134Gas StationMediumGreedyGreedy48.0%37.5%all
300Longest Increasing SubsequenceMediumDynamic ProgrammingState Transition59.4%37.5%all
239Sliding Window MaximumHardArraysSorting / Prefix / Scan; Sliding Window48.8%37.5%all
767Reorganize StringMediumStringsHashing / Sliding Window57.1%37.5%all
1944Number of Visible People in a QueueHardStack / QueueMonotonic Stack / Simulation73.1%37.5%all
1046Last Stone WeightEasyCore DSAImplementation / Reasoning66.5%37.5%all
1004Max Consecutive Ones IIIMediumCore DSAImplementation / Reasoning67.7%37.5%all
4Median of Two Sorted ArraysHardArrays; HeapSorting / Prefix / Scan; Priority Queue46.6%37.5%all
1335Minimum Difficulty of a Job ScheduleHardArraysSorting / Prefix / Scan59.8%37.5%all
465Optimal Account BalancingHardCore DSAImplementation / Reasoning50.5%37.5%all
21Merge Two Sorted ListsEasyArrays; Linked ListSorting / Prefix / Scan; Two Pointers68.3%37.5%all
125Valid PalindromeEasyStringsHashing / Sliding Window53.3%37.5%all
894All Possible Full Binary TreesMediumTreesDFS / BFS82.8%37.5%all
545Boundary of Binary TreeMediumTreesDFS / BFS48.1%37.5%all
2451Odd String DifferenceEasyStringsHashing / Sliding Window62.0%37.5%all
1209Remove All Adjacent Duplicates in String IIMediumArrays; StringsSorting / Prefix / Scan; Hashing / Sliding Window61.3%37.5%all
743Network Delay TimeMediumGraphsBFS / DFS / Topological Sort60.4%37.5%all
332Reconstruct ItineraryHardCore DSAImplementation / Reasoning44.6%37.5%all
268Missing NumberEasyArraysSorting / Prefix / Scan72.0%37.5%all
1438Longest Continuous Subarray With Absolute Diff Less Than or Equal to LimitMediumArraysSorting / Prefix / Scan57.7%37.5%all
12Integer to RomanMediumStringsHashing / Sliding Window71.0%25.0%all
13Roman to IntegerEasyStringsHashing / Sliding Window66.6%25.0%all
39Combination SumMediumArrays; BacktrackingSorting / Prefix / Scan; Backtracking76.5%25.0%all
221Maximal SquareMediumCore DSAImplementation / Reasoning50.3%25.0%all
238Product of Array Except SelfMediumArraysSorting / Prefix / Scan68.9%25.0%all
283Move ZeroesEasyCore DSATwo Pointers63.8%25.0%all
2296Design a Text EditorHardDesignData Structure Design50.7%25.0%all
370Range AdditionMediumCore DSAImplementation / Reasoning73.0%25.0%all
410Split Array Largest SumHardArraysSorting / Prefix / Scan60.4%25.0%all
621Task SchedulerMediumGreedyGreedy63.1%25.0%all
494Target SumMediumArraysSorting / Prefix / Scan52.2%25.0%all
831Masking Personal InformationMediumCore DSAImplementation / Reasoning55.2%25.0%all
152Maximum Product SubarrayMediumArraysSorting / Prefix / Scan36.4%25.0%all
2025Maximum Number of Ways to Partition an ArrayHardArrays; Dynamic ProgrammingSorting / Prefix / Scan; State Transition35.8%25.0%all
2472Maximum Number of Non-overlapping Palindrome SubstringsHardArrays; Strings; Trees; GreedySorting / Prefix / Scan; Hashing / Sliding Window; DFS / BFS; Greedy44.7%25.0%all
224Basic CalculatorHardStack / QueueMonotonic Stack / Simulation46.9%25.0%all
973K Closest Points to OriginMediumCore DSAImplementation / Reasoning69.0%25.0%all
636Exclusive Time of FunctionsMediumCore DSAImplementation / Reasoning66.2%25.0%all
2515Shortest Distance to Target String in a Circular ArrayEasyArrays; StringsSorting / Prefix / Scan; Hashing / Sliding Window65.2%25.0%all
289Game of LifeMediumCore DSAImplementation / Reasoning72.6%25.0%all
437Path Sum IIIMediumArrays; TreesSorting / Prefix / Scan; DFS / BFS46.4%25.0%all
135CandyHardCore DSAImplementation / Reasoning48.5%25.0%all
2008Maximum Earnings From TaxiMediumArraysSorting / Prefix / Scan46.5%25.0%all
1481Least Number of Unique Integers after K RemovalsMediumCore DSAImplementation / Reasoning63.8%25.0%all
844Backspace String CompareEasyStringsHashing / Sliding Window49.9%25.0%all
353Design Snake GameMediumDesignData Structure Design40.0%25.0%all
724Find Pivot IndexEasyCore DSAImplementation / Reasoning62.7%25.0%all
535Encode and Decode TinyURLMediumDynamic ProgrammingState Transition86.6%25.0%all
768Max Chunks To Make Sorted IIHardArraysSorting / Prefix / Scan54.8%25.0%all
815Bus RoutesHardCore DSAImplementation / Reasoning47.3%25.0%all
2918Minimum Equal Sum of Two Arrays After Replacing ZerosMediumArraysSorting / Prefix / Scan50.2%25.0%all
85Maximal RectangleHardCore DSAImplementation / Reasoning58.8%25.0%all
337House Robber IIIMediumDynamic ProgrammingState Transition55.9%25.0%all
2345Finding the Number of Visible MountainsMediumCore DSAImplementation / Reasoning37.3%25.0%all
1319Number of Operations to Make Network ConnectedMediumGraphsBFS / DFS / Topological Sort66.5%25.0%all
703Kth Largest Element in a StreamEasyHeapPriority Queue61.0%25.0%all
652Find Duplicate SubtreesMediumArrays; TreesSorting / Prefix / Scan; DFS / BFS60.7%25.0%all
630Course Schedule IIIHardGraphsBFS / DFS / Topological Sort41.7%25.0%all
2065Maximum Path Quality of a GraphHardArrays; GraphsSorting / Prefix / Scan; BFS / DFS / Topological Sort62.2%25.0%all
416Partition Equal Subset SumMediumArrays; Dynamic ProgrammingSorting / Prefix / Scan; State Transition49.5%25.0%all
678Valid Parenthesis StringMediumStringsHashing / Sliding Window40.1%25.0%all
1245Tree DiameterMediumTreesDFS / BFS61.3%25.0%all
144Binary Tree Preorder TraversalEasyTreesDFS / BFS75.8%25.0%all
2434Using a Robot to Print the Lexicographically Smallest StringMediumStrings; GraphsHashing / Sliding Window; BFS / DFS / Topological Sort62.3%25.0%all
3170Lexicographically Minimum String After Removing StarsMediumArrays; Strings; GraphsSorting / Prefix / Scan; Hashing / Sliding Window; BFS / DFS / Topological Sort51.0%25.0%all
2062Count Vowel Substrings of a StringEasyStrings; TreesHashing / Sliding Window; DFS / BFS73.2%25.0%all
54Spiral MatrixMediumArraysSorting / Prefix / Scan56.8%25.0%all
287Find the Duplicate NumberMediumArraysSorting / Prefix / Scan64.3%25.0%all
3366Minimum Array SumMediumArraysSorting / Prefix / Scan31.4%25.0%all
312Burst BalloonsHardCore DSAImplementation / Reasoning63.5%25.0%all
658Find K Closest ElementsMediumCore DSAImplementation / Reasoning49.7%25.0%all
518Coin Change IIMediumDynamic ProgrammingState Transition60.0%25.0%all
451Sort Characters By FrequencyMediumArrays; StringsSorting / Prefix / Scan; Hashing / Sliding Window75.3%25.0%all
981Time Based Key-Value StoreMediumCore DSAImplementation / Reasoning49.9%25.0%all
987Vertical Order Traversal of a Binary TreeHardTreesDFS / BFS53.8%25.0%all
727Minimum Window SubsequenceHardArraysSorting / Prefix / Scan; Sliding Window43.8%25.0%all
480Sliding Window MedianHardHeapPriority Queue; Sliding Window39.0%25.0%all