InterviewStack.io LogoInterviewStack.io

Arrays, Strings, and Linked Lists Mastery Questions

Foundational data structures: arrays, strings, and linked lists. Covers core operations (insertion, deletion, traversal, searching), pattern usage, edge cases, and time/space complexity analysis, with a focus on practical implementation and common interview-style problems across mainstream programming languages.

HardTechnical
0 practiced
Design serializeRandomList(head) and deserializeRandomList(data) in Python for a linked list where each node has next and random pointers (random may point to any node or null). Choose a serialization format, implement algorithms with O(n) time and O(n) space, and discuss trade-offs between using node indices vs pointers and human-readable vs compact formats.
MediumTechnical
0 practiced
Given two sorted arrays nums1 and nums2 where nums1 has length m + n with first m elements valid and last n zeros as buffer, implement merge(nums1, m, nums2, n) in Python to merge nums2 into nums1 in-place. Example: nums1 = [1,2,3,0,0,0], m = 3, nums2 = [2,5,6], n = 3 -> nums1 becomes [1,2,2,3,5,6]. Explain why scanning from the end works.
HardTechnical
0 practiced
Given a singly linked list, implement detectCycle(head) in Java that returns the node where the cycle begins or null if there is no cycle. Use Floyd's Tortoise and Hare algorithm and explain why meeting point leads to finding cycle start. Prove correctness and analyze time and space complexity and edge cases.
MediumTechnical
0 practiced
Implement findKthLargest(nums, k) in C++ using Quickselect to find the kth largest element in an unsorted array. Aim for expected O(n) time and O(1) extra space. Explain pivot selection strategies (randomized) to avoid worst-case behavior. Example: nums = [3,2,1,5,6,4], k = 2 -> 5.
HardTechnical
0 practiced
Describe and sketch an implementation of a lock-free singly linked list that supports concurrent insert(value), remove(value), and find(value) using atomic compare-and-swap (CAS). Discuss memory reclamation strategies (hazard pointers, epoch-based reclamation), the ABA problem, correctness criteria such as linearizability, and performance trade-offs compared to coarse-grained locking.

Unlock Full Question Bank

Get access to hundreds of Arrays, Strings, and Linked Lists Mastery interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.