Backend Developer
Arrays and strings questions
215 questions on Arrays and strings for backend developers, easiest first.
Easy 62
- Cost of reading arr[i]easy
- Inserting at the front of an arrayeasy
- Why push is amortized O(1)easy
- Changing one character of a stringeasy
- Reversing a simple stringeasy
- slice vs spliceeasy
- Index of the last elementeasy
- indexOf and NaNeasy
- When two pointers find a pair sumeasy
- new Array(3) then mapeasy
- Building a long string in a loopeasy
- Palindrome check with two pointerseasy
- Value missing from indexOfeasy
- Precondition for binary searcheasy
- Cleaning a pasted mobile numbereasy
- What a sliding window coverseasy
- Updating a fixed-size window sumeasy
- Range sum from a prefix arrayeasy
- Compute a range sumeasy
- Best three-day sales windoweasy
- Sliding window time complexityeasy
- Shape of a variable-size window loopeasy
- Length of a windoweasy
- Fast rectangle sums on a grideasy
- Many range increments at onceeasy
- Seven-day moving averageeasy
- How many subarrays existeasy
- Running wallet balanceeasy
- Cost of prefix sum querieseasy
- Sliding window and negative numberseasy
- First step in merging intervalseasy
- When two intervals overlapeasy
- Safe midpoint in binary searcheasy
- parseInt on a CSS valueeasy
- Number of an empty form fieldeasy
- Splitting a line with empty fieldseasy
- Where an element goes on transposeeasy
- Letter to array indexeasy
- Anagram check by sortingeasy
- Steps to find a value by binary searcheasy
- Can one person attend all meetingseasy
- Zero-padding an invoice numbereasy
- Spiral order of a 3x3 matrixeasy
- Checking balanced bracketseasy
- Case-insensitive comparison of nameseasy
- Checking whether a value is an arrayeasy
- Comparing an array with its copyeasy
- Using shift as a queueeasy
- join with null valueseasy
- Length of an emoji stringeasy
- Flattening a nested arrayeasy
- Subsequence and substringeasy
- Longest common subsequence of two stringseasy
- Operations counted by edit distanceeasy
- Edit distance from kitten to sittingeasy
- Table size for a two-string DPeasy
- Common substring versus common subsequenceeasy
- Palindromic substrings in "aaa"easy
- Booking the most meetings in one roomeasy
- Does a string have all unique characterseasy
- Does a sentence use every lettereasy
- Counting words regardless of caseeasy
Medium 93
- Trace a two-pointer pair searchmedium
- Remove duplicates from a sorted arraymedium
- Move zeroes to the endmedium
- Container with most water: which pointer movesmedium
- Time complexity of 3Summedium
- Reverse the words in a sentencemedium
- Rotate an array using reversalsmedium
- Rotating by more than the lengthmedium
- Merging into the larger arraymedium
- Sort 0s, 1s and 2s in one passmedium
- Squares of a sorted arraymedium
- Is one string a subsequence of anothermedium
- Copying an array of order objectsmedium
- Building a grid with fillmedium
- Comparing numeric stringsmedium
- Compute trapped rain watermedium
- Palindrome check on a real sentencemedium
- Majority element in O(1) spacemedium
- Maximum subarray summedium
- Best single buy and sellmedium
- Longest substring without repeatsmedium
- Shortest subarray reaching a targetmedium
- Character replacement window conditionmedium
- Longest run of ones with k flipsmedium
- Does a string contain an anagrammedium
- Maximum of every windowmedium
- Apply two range incrementsmedium
- Rectangle sum from a 2D prefix tablemedium
- Subarrays with product under kmedium
- Find the pivot indexmedium
- When to shrink in minimum window substringmedium
- Longest window with two distinct valuesmedium
- Counting windows with exactly kmedium
- Prefix sums overflowing intmedium
- Moving average over a streammedium
- Highest average over k valuesmedium
- XOR of a rangemedium
- Minimum starting balancemedium
- Longest run of ones after one deletionmedium
- Remove from both ends to reach xmedium
- Merge a list of intervalsmedium
- Do touching intervals mergemedium
- Minimum meeting rooms neededmedium
- Fewest intervals to removemedium
- Intersect two schedulesmedium
- First position of a repeated valuemedium
- Binary search in a rotated arraymedium
- Minimum of a rotated sorted arraymedium
- Parse an integer like atoimedium
- Rotate a square matrix in placemedium
- Set matrix zeroes with O(1) spacemedium
- Splitting CSV with quoted commasmedium
- Evaluate an expression with precedencemedium
- Decode a nested repeat stringmedium
- Comparing version stringsmedium
- Roman numeral to integermedium
- Run-length compression of a stringmedium
- Longest common prefixmedium
- Binary search a matrix as one arraymedium
- Insert a new intervalmedium
- Next greater elementmedium
- Days until a warmer daymedium
- forEach on an array with holesmedium
- Overflow in an Int32Arraymedium
- Reading the last elementmedium
- All duplicates with O(1) extra spacemedium
- Is one string a rotation of anothermedium
- Where to start a circular routemedium
- Ways to decode a digit stringmedium
- Decoding a string that starts with zeromedium
- Splitting text into dictionary wordsmedium
- Longest palindromic subsequencemedium
- Longest palindromic substring in O(1) spacemedium
- Ways a word appears as a subsequencemedium
- Checking an interleaving of two stringsmedium
- Handling "*" in regex matching DPmedium
- Wildcard "*" versus regex "*"medium
- Fewest bookings to cancelmedium
- Group anagrams togethermedium
- Duplicate within k positionsmedium
- Isomorphic stringsmedium
- Matching words to a patternmedium
- First non-repeating charactermedium
- Repeated 10-letter DNA sequencesmedium
- Most common words in support ticketsmedium
- Which Sudoku box a cell belongs tomedium
- Longest palindrome from given lettersmedium
- Words that appear in only one sentencemedium
- Characters common to every wordmedium
- Duplicate accounts with different email spellingmedium
- Bouncing a ball off the floormedium
- Is the player in front of the guardmedium
- Enemy vanishes on reaching playermedium
Hard 60
- Why rain water two pointers move the lower sidehard
- Kadane returns 0 for all negativeshard
- Avoiding duplicate triplets in 3Sumhard
- Next lexicographic permutationhard
- Find the duplicate without extra spacehard
- Product of array except selfhard
- Smallest missing positive integerhard
- Median of two sorted arrayshard
- Quickselect for the k-th largesthard
- Reversing a string that has emojihard
- Boyer–Moore without a guaranteed majorityhard
- Maximum product subarrayhard
- Sorting a file larger than memoryhard
- Removing items while looping forwardhard
- Dutch flag: when mid must not advancehard
- Shortest subarray with sum at least K, with negativeshard
- Sliding window medianhard
- Substrings containing a, b and chard
- Maximum sum of a circular subarrayhard
- Maximum sum rectangle in a matrixhard
- Running time of minimum window substringhard
- The non-shrinking window trickhard
- Sum of all subarray sumshard
- Running totals of rupee amountshard
- Range updates mixed with range querieshard
- Rate limiting with a time windowhard
- Subarrays with exactly two distinct valueshard
- Why the max deque stores indexeshard
- Bug in a minimum length windowhard
- Fewest swaps to group all oneshard
- Minimum eating speed by binary searchhard
- Least ship capacity for a deadlinehard
- Binary search that never endshard
- Common free time across many calendarshard
- Most meetings in one roomhard
- Search a matrix sorted by rows and columnshard
- KMP failure tablehard
- Rabin–Karp and hash collisionshard
- Longest palindromic substringhard
- Parsing a date-only stringhard
- Two identical-looking names that differhard
- Sorting file names with numbershard
- Counting inversionshard
- Largest number from concatenationhard
- Fewest arrows for overlapping balloonshard
- Largest rectangle in a histogramhard
- Sum of all subarray minimumshard
- Remove k digits for the smallest numberhard
- Asteroid collisionhard
- Sorting by two keys with a stable sorthard
- Shortest string containing two stringshard
- Fewest cuts into palindromeshard
- Matching customer names with typoshard
- Breaking text into neat lineshard
- Fewest rooms for overlapping meetingshard
- Reducing rolling hash collisionshard
- Bug in an at-most-two-distinct windowhard
- Distinct values in every windowhard
- Rows that match columns in a gridhard
- Do two booking slots overlaphard