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.
MediumTechnical
0 practiced
Implement removeNthFromEnd(head, n) in C++ that removes the nth node from the end of a singly linked list in one pass and returns the head of the modified list. Use a two-pointer approach (fast and slow). Example: 1->2->3->4->5, n = 2 -> 1->2->3->5. Handle cases where n equals list length and when the list has a single node.
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.
MediumTechnical
0 practiced
Given singly linked list L: L0->L1->...->Ln, implement reorderList(head) in C++ to transform it to L0->Ln->L1->Ln-1->... in-place without changing node values and using O(1) extra memory. Explain steps: find middle, reverse second half, merge halves and discuss correctness and complexity.
EasyTechnical
0 practiced
Write reverseWords(s) in JavaScript that reverses the order of words in the string s, trims leading/trailing spaces, and reduces multiple spaces between words to a single space. Example: s = ' the sky is blue ' -> 'blue is sky the'. Discuss in-place vs creating new string trade-offs and complexity.
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.
Unlock Full Question Bank
Get access to hundreds of Arrays, Strings, and Linked Lists Mastery interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.