Foundation·Concept·2 min read

Arrays and strings

Practice this question

Arrays

Array is a fixed or dynamic collection of values stored in index order.

Important questions

  • Two Sum
  • Best Time to Buy and Sell Stock
  • Contains Duplicate
  • Product of Array Except Self
  • Maximum Subarray
  • Merge Intervals
  • Rotate Array
  • Move Zeroes

String patterns

  • Valid Palindrome
  • Longest Substring Without Repeating Characters
  • Group Anagrams
  • String Anagram Check
  • Reverse Words in a String
  • Longest Common Prefix

Common patterns

  • Two pointers
  • Sliding window
  • Prefix/suffix sums
  • Hash map for frequency

Example interview answer

“Since we need to check matches efficiently, I would use a hash map to count frequencies and compare. This reduces repeated scanning and gives O(n) time.”


Adapted from 14_DSA_MASTER.md · “3. Arrays and strings”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.