InterviewStack.io LogoInterviewStack.io

Array and String Manipulation Questions

Comprehensive coverage of language level operations and algorithmic techniques for arrays and strings that are commonly evaluated in coding interviews. Candidates should understand common language methods for arrays and strings, including their parameters and return values, chaining of operations, and the implications of mutable versus immutable types for in place versus extra space solutions. Core algorithmic patterns include iteration and traversal, index based and pointer based approaches, two pointer strategies, sliding window, prefix and suffix sums, sorting and partitioning, and cumulative or running sums. Problem classes include traversal, insertion and deletion, reversing and rotating, merging and deduplicating, subarray and substring search, anagram detection, palindrome detection, longest substring and maximum subarray problems, and pointer based reordering and partitioning tasks. Pattern matching techniques include naive matching, Knuth Morris Pratt and rolling hash approaches, and hashing for frequency and membership checks. String transformation and comparison topics include edit distance, sequence transformation problems such as word ladder, and parsing and validation tasks. Candidates should be prepared to implement correct and efficient solutions in common programming languages, reason about time and space complexity, optimize for input size and memory constraints, handle edge cases such as empty inputs and boundary conditions, and address character level concerns such as encoding differences, multibyte characters, surrogate pairs and unicode normalization. Interviewers may probe language specific implementation details, in place mutation versus copying, fixed buffer strategies, streaming or incremental algorithms for large inputs, and trade offs between clarity and performance. Expect questions that require selecting the right algorithmic pattern, implementing a robust solution, and justifying complexity and memory decisions.

MediumTechnical
64 practiced
Given two sorted arrays A and B where A has length m+n with the first m elements valid and the last n positions empty and B has n elements, implement in Python an in-place merge so that A contains the sorted result of size m+n. Aim for O(m+n) time and O(1) extra space. Explain edge cases and how you'd adapt to arrays of strings or very large elements.
HardTechnical
54 practiced
Implement in Go a function that validates an io.Reader byte stream as UTF-8 and counts Unicode code points. The reader must be consumed in fixed-size chunks (e.g., 4096 bytes) without loading the whole stream. The function should correctly handle multibyte sequences split across chunk boundaries and report the byte offset of the first invalid sequence if any.
MediumTechnical
45 practiced
Describe and implement (pseudocode or Python) a method to check whether a user-visible string is a palindrome while accounting for Unicode normalization (NFC/NFD), case-folding, ignoring combining marks, and skipping non-letter characters. Explain why naive byte-wise or codepoint-wise checks can be incorrect when combining marks or different normalization forms appear.
MediumTechnical
44 practiced
Implement a robust CSV tokenizer in Python that splits a single CSV line into fields, correctly handling quoted fields, escaped quotes ("" representing a quote inside a quoted field), and custom delimiters. Example: input 'a,"b,c",d' should produce ['a', 'b,c', 'd']. Describe how to extend this to streaming CSVs with quoted fields that span multiple lines.
MediumTechnical
47 practiced
Implement a function in Go that given a slice of integers representing per-second request counts and an integer k returns the maximum sum of any contiguous k-second window. The solution must be O(n) time and O(1) extra space. Handle edge cases such as k<=0, k>len(slice), and empty input; describe how you'd test for off-by-one errors with metric streams.

Unlock Full Question Bank

Get access to hundreds of Array and String Manipulation interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.