# Salesforce Coding Interview Questions

> 189 DSA problems asked in Salesforce coding interviews and online assessments, sorted easiest first with hints. Free practice for placements on InternHack.

Canonical: https://www.internhack.in/learn/dsa/companies/salesforce
Last updated: 2026-11-28

189 DSA problems tagged as asked in Salesforce coding interviews and online assessments. Below are the first 100 of 189: 27 easy, 24 medium and 49 hard. Start with the easy ones, then move to medium. Practise free on InternHack and track your progress.

## Salesforce DSA problems, easiest first

1. [Backspace String Compare](https://www.internhack.in/learn/dsa/problem/backspace-string-compare) (Easy)
2. [Best Time to Buy and Sell Stock](https://www.internhack.in/learn/dsa/problem/best-time-to-buy-and-sell-stock) (Easy)
3. [Binary Tree Preorder Traversal](https://www.internhack.in/learn/dsa/problem/binary-tree-preorder-traversal) (Easy)
4. [Check If a Number Is Majority Element in a Sorted Array](https://www.internhack.in/learn/dsa/problem/check-if-a-number-is-majority-element-in-a-sorted-array) (Easy)
5. [Check Whether Two Strings are Almost Equivalent](https://www.internhack.in/learn/dsa/problem/check-whether-two-strings-are-almost-equivalent) (Easy)
6. [Count Binary Substrings](https://www.internhack.in/learn/dsa/problem/count-binary-substrings) (Easy)
7. [Count Vowel Substrings of a String](https://www.internhack.in/learn/dsa/problem/count-vowel-substrings-of-a-string) (Easy)
8. [Find Pivot Index](https://www.internhack.in/learn/dsa/problem/find-pivot-index) (Easy)
9. [Height Checker](https://www.internhack.in/learn/dsa/problem/height-checker) (Easy)
10. [Kth Largest Element in a Stream](https://www.internhack.in/learn/dsa/problem/kth-largest-element-in-a-stream) (Easy)
11. [Largest Number After Digit Swaps by Parity](https://www.internhack.in/learn/dsa/problem/largest-number-after-digit-swaps-by-parity) (Easy)
12. [Last Stone Weight](https://www.internhack.in/learn/dsa/problem/last-stone-weight) (Easy)
13. [Matrix Similarity After Cyclic Shifts](https://www.internhack.in/learn/dsa/problem/matrix-similarity-after-cyclic-shifts) (Easy)
14. [Maximum Height of a Triangle](https://www.internhack.in/learn/dsa/problem/maximum-height-of-a-triangle) (Easy)
15. [Maximum Product of Three Numbers](https://www.internhack.in/learn/dsa/problem/maximum-product-of-three-numbers) (Easy)
16. [Maximum Units on a Truck](https://www.internhack.in/learn/dsa/problem/maximum-units-on-a-truck) (Easy)
17. [Merge Two Sorted Lists](https://www.internhack.in/learn/dsa/problem/merge-two-sorted-lists) (Easy)
18. [Minimum Absolute Difference](https://www.internhack.in/learn/dsa/problem/minimum-absolute-difference) (Easy)
19. [Missing Number](https://www.internhack.in/learn/dsa/problem/missing-number) (Easy)
20. [Move Zeroes](https://www.internhack.in/learn/dsa/problem/move-zeroes) (Easy)
21. [Odd String Difference](https://www.internhack.in/learn/dsa/problem/odd-string-difference) (Easy)
22. [Roman to Integer](https://www.internhack.in/learn/dsa/problem/roman-to-integer) (Easy)
23. [Shortest Distance to Target String in a Circular Array](https://www.internhack.in/learn/dsa/problem/shortest-distance-to-target-string-in-a-circular-array) (Easy)
24. [Split a String in Balanced Strings](https://www.internhack.in/learn/dsa/problem/split-a-string-in-balanced-strings) (Easy)
25. [Two Sum](https://www.internhack.in/learn/dsa/problem/two-sum) (Easy)
26. [Valid Palindrome](https://www.internhack.in/learn/dsa/problem/valid-palindrome) (Easy)
27. [Valid Parentheses](https://www.internhack.in/learn/dsa/problem/valid-parentheses) (Easy)
28. [Average Waiting Time](https://www.internhack.in/learn/dsa/problem/average-waiting-time) (Medium)
29. [Beautiful Towers I](https://www.internhack.in/learn/dsa/problem/beautiful-towers-i) (Medium)
30. [Beautiful Towers II](https://www.internhack.in/learn/dsa/problem/beautiful-towers-ii) (Medium)
31. [Count the Number of Fair Pairs](https://www.internhack.in/learn/dsa/problem/count-the-number-of-fair-pairs) (Medium)
32. [Diameter of N-Ary Tree](https://www.internhack.in/learn/dsa/problem/diameter-of-n-ary-tree) (Medium)
33. [Finding the Number of Visible Mountains](https://www.internhack.in/learn/dsa/problem/finding-the-number-of-visible-mountains) (Medium)
34. [Least Number of Unique Integers after K Removals](https://www.internhack.in/learn/dsa/problem/least-number-of-unique-integers-after-k-removals) (Medium)
35. [Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit](https://www.internhack.in/learn/dsa/problem/longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit) (Medium)
36. [Longest Substring Of All Vowels in Order](https://www.internhack.in/learn/dsa/problem/longest-substring-of-all-vowels-in-order) (Medium)
37. [Magnetic Force Between Two Balls](https://www.internhack.in/learn/dsa/problem/magnetic-force-between-two-balls) (Medium)
38. [Maximize Greatness of an Array](https://www.internhack.in/learn/dsa/problem/maximize-greatness-of-an-array) (Medium)
39. [Maximum Earnings From Taxi](https://www.internhack.in/learn/dsa/problem/maximum-earnings-from-taxi) (Medium)
40. [Maximum Number of Occurrences of a Substring](https://www.internhack.in/learn/dsa/problem/maximum-number-of-occurrences-of-a-substring) (Medium)
41. [Minimum Equal Sum of Two Arrays After Replacing Zeros](https://www.internhack.in/learn/dsa/problem/minimum-equal-sum-of-two-arrays-after-replacing-zeros) (Medium)
42. [Minimum Operations to Reduce an Integer to 0](https://www.internhack.in/learn/dsa/problem/minimum-operations-to-reduce-an-integer-to-0) (Medium)
43. [Number of Divisible Triplet Sums](https://www.internhack.in/learn/dsa/problem/number-of-divisible-triplet-sums) (Medium)
44. [Number of Operations to Make Network Connected](https://www.internhack.in/learn/dsa/problem/number-of-operations-to-make-network-connected) (Medium)
45. [Paths in Maze That Lead to Same Room](https://www.internhack.in/learn/dsa/problem/paths-in-maze-that-lead-to-same-room) (Medium)
46. [Remove Adjacent Almost-Equal Characters](https://www.internhack.in/learn/dsa/problem/remove-adjacent-almost-equal-characters) (Medium)
47. [Search Suggestions System](https://www.internhack.in/learn/dsa/problem/search-suggestions-system) (Medium)
48. [Sum of Nodes with Even-Valued Grandparent](https://www.internhack.in/learn/dsa/problem/sum-of-nodes-with-even-valued-grandparent) (Medium)
49. [The kth Factor of n](https://www.internhack.in/learn/dsa/problem/the-kth-factor-of-n) (Medium)
50. [Time Needed to Rearrange a Binary String](https://www.internhack.in/learn/dsa/problem/time-needed-to-rearrange-a-binary-string) (Medium)
51. [Using a Robot to Print the Lexicographically Smallest String](https://www.internhack.in/learn/dsa/problem/using-a-robot-to-print-the-lexicographically-smallest-string) (Medium)
52. [Basic Calculator](https://www.internhack.in/learn/dsa/problem/basic-calculator) (Hard)
53. [Binary Tree Maximum Path Sum](https://www.internhack.in/learn/dsa/problem/binary-tree-maximum-path-sum) (Hard)
54. [Bus Routes](https://www.internhack.in/learn/dsa/problem/bus-routes) (Hard)
55. [Candy](https://www.internhack.in/learn/dsa/problem/candy) (Hard)
56. [Cherry Pickup II](https://www.internhack.in/learn/dsa/problem/cherry-pickup-ii) (Hard)
57. [Collect Coins in a Tree](https://www.internhack.in/learn/dsa/problem/collect-coins-in-a-tree) (Hard)
58. [Concatenated Words](https://www.internhack.in/learn/dsa/problem/concatenated-words) (Hard)
59. [Count Palindromic Subsequences](https://www.internhack.in/learn/dsa/problem/count-palindromic-subsequences) (Hard)
60. [Count Subarrays With Median K](https://www.internhack.in/learn/dsa/problem/count-subarrays-with-median-k) (Hard)
61. [Count the Number of Infection Sequences](https://www.internhack.in/learn/dsa/problem/count-the-number-of-infection-sequences) (Hard)
62. [Count the Number of Inversions](https://www.internhack.in/learn/dsa/problem/count-the-number-of-inversions) (Hard)
63. [Course Schedule III](https://www.internhack.in/learn/dsa/problem/course-schedule-iii) (Hard)
64. [Design a Text Editor](https://www.internhack.in/learn/dsa/problem/design-a-text-editor) (Hard)
65. [Distinct Subsequences](https://www.internhack.in/learn/dsa/problem/distinct-subsequences) (Hard)
66. [Find Median from Data Stream](https://www.internhack.in/learn/dsa/problem/find-median-from-data-stream) (Hard)
67. [Find Subarray With Bitwise OR Closest to K](https://www.internhack.in/learn/dsa/problem/find-subarray-with-bitwise-or-closest-to-k) (Hard)
68. [Find the Last Marked Nodes in Tree](https://www.internhack.in/learn/dsa/problem/find-the-last-marked-nodes-in-tree) (Hard)
69. [Find the Minimum Area to Cover All Ones II](https://www.internhack.in/learn/dsa/problem/find-the-minimum-area-to-cover-all-ones-ii) (Hard)
70. [First Missing Positive](https://www.internhack.in/learn/dsa/problem/first-missing-positive) (Hard)
71. [IPO](https://www.internhack.in/learn/dsa/problem/ipo) (Hard)
72. [LFU Cache](https://www.internhack.in/learn/dsa/problem/lfu-cache) (Hard)
73. [Longest Increasing Path in a Matrix](https://www.internhack.in/learn/dsa/problem/longest-increasing-path-in-a-matrix) (Hard)
74. [Max Chunks To Make Sorted II](https://www.internhack.in/learn/dsa/problem/max-chunks-to-make-sorted-ii) (Hard)
75. [Maximal Rectangle](https://www.internhack.in/learn/dsa/problem/maximal-rectangle) (Hard)
76. [Maximize Grid Happiness](https://www.internhack.in/learn/dsa/problem/maximize-grid-happiness) (Hard)
77. [Maximum Frequency Stack](https://www.internhack.in/learn/dsa/problem/maximum-frequency-stack) (Hard)
78. [Maximum Number of Non-overlapping Palindrome Substrings](https://www.internhack.in/learn/dsa/problem/maximum-number-of-non-overlapping-palindrome-substrings) (Hard)
79. [Maximum Number of Ways to Partition an Array](https://www.internhack.in/learn/dsa/problem/maximum-number-of-ways-to-partition-an-array) (Hard)
80. [Maximum Path Quality of a Graph](https://www.internhack.in/learn/dsa/problem/maximum-path-quality-of-a-graph) (Hard)
81. [Median of Two Sorted Arrays](https://www.internhack.in/learn/dsa/problem/median-of-two-sorted-arrays) (Hard)
82. [Merge k Sorted Lists](https://www.internhack.in/learn/dsa/problem/merge-k-sorted-lists) (Hard)
83. [Minimize Malware Spread](https://www.internhack.in/learn/dsa/problem/minimize-malware-spread) (Hard)
84. [Minimum Difficulty of a Job Schedule](https://www.internhack.in/learn/dsa/problem/minimum-difficulty-of-a-job-schedule) (Hard)
85. [Minimum Number of Taps to Open to Water a Garden](https://www.internhack.in/learn/dsa/problem/minimum-number-of-taps-to-open-to-water-a-garden) (Hard)
86. [Minimum Window Substring](https://www.internhack.in/learn/dsa/problem/minimum-window-substring) (Hard)
87. [N-Queens](https://www.internhack.in/learn/dsa/problem/n-queens) (Hard)
88. [Number of Digit One](https://www.internhack.in/learn/dsa/problem/number-of-digit-one) (Hard)
89. [Number of Visible People in a Queue](https://www.internhack.in/learn/dsa/problem/number-of-visible-people-in-a-queue) (Hard)
90. [Optimal Account Balancing](https://www.internhack.in/learn/dsa/problem/optimal-account-balancing) (Hard)
91. [Partition Array Into Two Arrays to Minimize Sum Difference](https://www.internhack.in/learn/dsa/problem/partition-array-into-two-arrays-to-minimize-sum-difference) (Hard)
92. [Reconstruct Itinerary](https://www.internhack.in/learn/dsa/problem/reconstruct-itinerary) (Hard)
93. [Reverse Nodes in k-Group](https://www.internhack.in/learn/dsa/problem/reverse-nodes-in-k-group) (Hard)
94. [Sliding Window Maximum](https://www.internhack.in/learn/dsa/problem/sliding-window-maximum) (Hard)
95. [Smallest Substring With Identical Characters I](https://www.internhack.in/learn/dsa/problem/smallest-substring-with-identical-characters-i) (Hard)
96. [Smallest Substring With Identical Characters II](https://www.internhack.in/learn/dsa/problem/smallest-substring-with-identical-characters-ii) (Hard)
97. [Split Array Largest Sum](https://www.internhack.in/learn/dsa/problem/split-array-largest-sum) (Hard)
98. [Subarrays with K Different Integers](https://www.internhack.in/learn/dsa/problem/subarrays-with-k-different-integers) (Hard)
99. [Trapping Rain Water](https://www.internhack.in/learn/dsa/problem/trapping-rain-water) (Hard)
100. [Word Ladder](https://www.internhack.in/learn/dsa/problem/word-ladder) (Hard)

## Prepare for the rest of the Salesforce process

- [Aptitude questions by company](https://www.internhack.in/learn/aptitude/companies)
- [Technical interview questions](https://www.internhack.in/learn/interview)
- [Free ATS resume check](https://www.internhack.in/ats-score/try), no signup

## Other companies

- [Google](https://www.internhack.in/learn/dsa/companies/google) (2217)
- [Amazon](https://www.internhack.in/learn/dsa/companies/amazon) (1938)
- [Meta](https://www.internhack.in/learn/dsa/companies/meta) (1387)
- [Microsoft](https://www.internhack.in/learn/dsa/companies/microsoft) (1352)
- [Bloomberg](https://www.internhack.in/learn/dsa/companies/bloomberg) (1173)
- [Tiktok](https://www.internhack.in/learn/dsa/companies/tiktok) (383)
- [Uber](https://www.internhack.in/learn/dsa/companies/uber) (381)
- [Apple](https://www.internhack.in/learn/dsa/companies/apple) (356)
- [Oracle](https://www.internhack.in/learn/dsa/companies/oracle) (340)
- [Goldman Sachs](https://www.internhack.in/learn/dsa/companies/goldman-sachs) (270)
- [Adobe](https://www.internhack.in/learn/dsa/companies/adobe) (227)
- [TCS](https://www.internhack.in/learn/dsa/companies/tcs) (217)
- [Linkedin](https://www.internhack.in/learn/dsa/companies/linkedin) (180)
- [Zoho](https://www.internhack.in/learn/dsa/companies/zoho) (179)
- [IBM](https://www.internhack.in/learn/dsa/companies/ibm) (170)
- [Infosys](https://www.internhack.in/learn/dsa/companies/infosys) (158)
- [Walmart Labs](https://www.internhack.in/learn/dsa/companies/walmart-labs) (152)
- [Accenture](https://www.internhack.in/learn/dsa/companies/accenture) (144)
- [Nvidia](https://www.internhack.in/learn/dsa/companies/nvidia) (137)
- [Yandex](https://www.internhack.in/learn/dsa/companies/yandex) (134)
- [DE Shaw](https://www.internhack.in/learn/dsa/companies/de-shaw) (124)
- [Visa](https://www.internhack.in/learn/dsa/companies/visa) (124)
- [Flipkart](https://www.internhack.in/learn/dsa/companies/flipkart) (117)
- [Paypal](https://www.internhack.in/learn/dsa/companies/paypal) (106)

## Related

- [Home](https://www.internhack.in/)
- [Learn](https://www.internhack.in/learn)
- [DSA by company](https://www.internhack.in/learn/dsa/companies)
