Frontend Developer Focus DSA
For most frontend developer roles, companies generally don’t focus heavily on DSA.
However, if you are an experienced candidate, it’s still important to prepare some
essential, easy-level DSA [Link] these 100 curated DSA questions will
be more than sufficient for typical frontend interviews.
Disclaimer:
If you’re preparing for FAANG or other top-tier product companies, you will need to
cover more advanced DSA topics, including Recursion, Trees, Graphs, and other
complex patterns.
Suggestion:
You need to understand the problem, the topic, and the solution. My suggestion is to
copy each question and search it on YouTube—add the word “JavaScript” after the
question. The explanations and visualizations in YouTube videos will help you
understand the concepts much better than reading them on ChatGPT.
You can also use ChatGPT to get solutions, but it works best when you already
understand the problem and only need clarification or a quick refresh.
1. Given a string, return the first character that does not repeat anywhere else in the
string.
2. Rotate an array to the right by k positions without using any extra array.
3. Find the longest substring in a string that contains no repeating characters.
4. Given an array of numbers, move all zero values to the end while keeping non-
zero values in the same relative order.
5. Determine whether two strings are anagrams by comparing character
frequencies.
6. Given an array of integers, return the index of the second highest number.
7. Remove duplicate characters from a string while preserving the order of first
appearance.
8. Return the maximum sum of any contiguous subarray.
9. Reverse the order of words in a sentence without using built-in split().
10. From an array of integers, return all unique pairs that sum to a target value.
11. Given a sentence, check whether it is a palindrome after removing spaces and
punctuation.
12. Given an array, return true if it contains any duplicate numbers.
13. Replace every space in a string with "%20".
14. Find the majority element in an array (element that appears more than half).
15. Count how many times each character appears in a string and return the
frequency map.
16. Remove all duplicate values from an array and return the cleaned version.
17. Given a string, find the longest palindromic substring inside it.
18. Find the missing number from an array that contains numbers 0 to n with one
number missing.
19. Check whether two strings become equal after processing backspaces
represented by "#".
20. Merge two sorted arrays into a single sorted array.
21. Given a string, reverse every individual word while keeping word order intact.
22. Determine the smallest value in a rotated sorted array.
23. Return all permutations of a given string.
24. Given an array, calculate the product of all values except the current index for
each position.
25. Check whether two strings follow the same pattern based on character mapping.
26. Given an array of numbers, separate all even values to the front and odd values
to the back.
27. Validate whether a string of brackets is balanced and correctly nested.
28. Return all possible subsets from an array of numbers.
29. Remove all vowels from a string and return the modified result.
30. Count how many subarrays have a sum equal to a given target.
31. Given a string, return the longest word found inside it.
32. Find all unique triplets in an array that sum to zero.
33. Compress a string by counting repeated characters (e.g., aabbb → a2b3).
34. Reverse an array entirely without using reverse().
35. From two strings, remove all characters in the second string from the first.
36. Given an array, find the longest increasing subsequence.
37. Determine if one string is a rotation of another string.
38. Given an array of numbers, count how many pairs differ by exactly k.
39. Convert a Roman numeral string into its integer value.
40. Given an array, find the first element that appears only once.
41. Check whether a sentence contains all the letters from 'a' to 'z' (pangram test).
42. From an array of intervals, merge overlapping intervals.
43. From a string, return all substrings that are palindromes.
44. From an array, return the longest consecutive sequence of numbers.
45. Format a string by removing repeated sequential characters (“aaabb” → “ab”).
46. Find the peak element in an array that is greater than its neighbors.
47. Given two strings, determine whether one is a subsequence of the other.
48. Given an array of integers, sort values containing only 0s, 1s, and 2s.
49. Convert each character of a string to its ASCII value and return the list.
50. Given an array, return how many subarrays contain an equal number of 0s and
1s.
51. Reverse only the vowels in a string without changing consonant positions.
52. Find the smallest subarray whose sum is at least a target value.
53. Given a sentence, convert every word into title case.
54. Find all elements that appear more than n/3 times in an array.
55. Given a string, check if all characters in it are unique.
56. Compute how much water can be trapped between bars represented by an
array.
57. Rearrange characters of a string so that no two adjacent characters are the
same.
58. Given an array, return the kth smallest value.
59. Replace only the first occurrence of a substring in a string.
60. Determine whether an array is a rotated version of a sorted array.
61. Given a string, count how many substrings start and end with the same
character.
62. From an array, return all duplicate numbers.
63. Given a string, validate it as a simplified email format.
64. From an array, find the number of inversions (where a larger value appears
before smaller).
65. Capitalize the first letter of every sentence inside a long string.
66. Given heights in an array, find two lines that form the container with the most
water.
67. Check whether a string can be rearranged to form a palindrome.
68. From an array, find the minimum number of jumps to reach the end.
69. Remove consecutive duplicate words from a sentence.
70. From an array, return a new array of running sums.
71. Validate a password string that must include uppercase, lowercase, digits, and
special characters.
72. Given an array of strings, group them together if they are anagrams.
73. Given a string, split it into chunks of size k and return all chunks.
74. From an array of integers, return the next greater element for every value.
75. Given a string, return the lexicographically smallest string possible after removing
k characters.
76. Rotate an array left by k positions.
77. Given a string containing digits, produce all possible letter combinations like a
phone keypad.
78. Find the minimum positive integer missing from an array.
79. Clean a string by removing digits and keeping only English letters.
80. From an array, return all possible contiguous subarrays.
81. Given two sentences, return the list of words that appear in both.
82. Arrange an array so positive and negative numbers alternate.
83. Given a string of parentheses, find the longest valid parentheses substring.
84. From an array, compute how many times each element appears.
85. Check whether a string matches a pattern using "." and "*" special characters
(basic regex).
86. Given two arrays, return the intersection of elements.
87. Remove all characters from a string that appear more than once.
88. From a sorted array, remove duplicates and return the length of the unique part.
89. Given a string, return the number of digits inside it.
90. From an array, return the pair of numbers with the largest product.
91. Convert a string into its mirror image by reversing only alphabets.
92. Given an array, check if a subarray with sum zero exists.
93. Mask a string so that only the last 4 characters remain visible.
94. Find the median of two sorted arrays.
95. Given a string, rearrange it to form the maximum possible numeric or
lexicographic value.
96. From an array, return the frequency-sorted result (high frequency first).
97. Remove all leading and trailing spaces from a string without using trim().
98. Given an array of numbers, return the longest mountain subarray (increasing
then decreasing).
99. Determine if a string is composed of a repeating substring pattern.
100. Given an array of strings, sort them by their lengths.