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.

EasyTechnical
47 practiced
Write a Python function that simplifies a Unix-style path string by resolving '.' and '..' components and removing redundant slashes. For example, input '/a/./b/../../c/' should return '/c'. Handle edge cases such as paths that try to go above root and empty input.
EasyTechnical
50 practiced
Theoretical: Explain the difference between mutable and immutable string types in languages commonly used by data engineers (for example Python str vs bytearray, Java String vs StringBuilder). Discuss implications for in-place mutation, memory allocation, concurrency, and performance when processing large text datasets in ETL pipelines.
EasyTechnical
66 practiced
Given a sorted array of integers, implement a function in Python that finds two numbers that add up to a target value and returns their indices (or (-1, -1) if none). The solution must run in O(n) time and use O(1) extra space. Discuss how the two-pointer technique works and edge cases like duplicates and negative numbers.
HardTechnical
64 practiced
Given a mutable byte array representing a UTF-8 encoded sentence where words are separated by single space characters, implement an in-place algorithm to reverse the order of words without allocating a buffer proportional to the sentence length. Carefully describe how you identify UTF-8 character boundaries so that multi-byte characters are not corrupted.
EasyTechnical
61 practiced
Given a sorted array of integers stored in a mutable array/list in Python, remove duplicates in-place so that each element appears only once and return the new length. You must perform the operation in O(n) time and O(1) additional space, modifying the input array in-place. Describe handling of edge cases like empty arrays and arrays with all duplicates.

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.