Data Structures u0026 Algorithms: Arrays u0026 Strings Quiz

This quiz challenges your understanding of complex array and string operations, including sliding window, two pointer methods, and string manipulation. Each question is designed to assess problem-solving skills at an advanced level.

  1. Sliding Window Maximum

    Given an integer array [1,3,-1,-3,5,3,6,7] and window size k=3, what is the correct output of the sliding window maximum algorithm?

    1. [3,1,5,3,6,7]
    2. [3,3,5,5,7,7]
    3. [1,3,-1,-3,5,3,6]
    4. [3,3,5,5,6,7]
    5. [1,3,3,5,5,6]
  2. Longest Substring Without Repeating Characters

    For the string 'abcabcbb', what is the length of the longest substring without repeating characters using the sliding window approach?

    1. 2
    2. 5
    3. 3
    4. 1
    5. 4
  3. Two Pointer Technique Application

    In a sorted array [1,2,3,4,6,8,9], how many unique pairs have a sum equal to 10 using the two pointer technique?

    1. 3
    2. 1
    3. 4
    4. 0
    5. 2
  4. Minimum Window Substring

    Given the string S = 'ADOBECODEBANC' and T = 'ABC', what is the minimum window substring of S that contains all characters of T?

    1. 'CODEBANC'
    2. 'ADOBECODEB'
    3. 'BANC'
    4. 'CODEBA'
    5. 'ADOBEC'
  5. Array Rotation Algorithm

    After rotating the array [1,2,3,4,5,6,7] to the right by 3 steps in-place, what is the resulting array?

    1. [4,5,6,7,1,2,3]
    2. [3,4,5,6,7,1,2]
    3. [7,6,5,4,3,2,1]
    4. [6,7,1,2,3,4,5]
    5. [5,6,7,1,2,3,4]
  6. Anagram Detection Using Sliding Window

    For string S = 'cbaebabacd' and P = 'abc', how many start indices of anagram of P in S can be found using a sliding window?

    1. 2
    2. 4
    3. 1
    4. 3
    5. 0
  7. Merge Sorted Arrays In-Place

    Given two sorted arrays nums1 = [1,2,3,0,0,0] and nums2 = [2,5,6] (nums1 has enough space), merging in-place results in which array?

    1. [1,2,3,5,6,0]
    2. [1,2,3,2,5,6]
    3. [1,2,2,3,5,6]
    4. [1,2,3,0,5,6]
    5. [2,5,6,1,2,3]
  8. Longest Palindromic Substring

    In the string 'babad', what is the longest palindromic substring found using a center expansion method?

    1. 'dad'
    2. 'bab'
    3. 'bad'
    4. 'baba'
    5. 'aba'
  9. Maximum Sum Subarray (Kadane's Algorithm)

    For array [-2,1,-3,4,-1,2,1,-5,4], what is the maximum subarray sum determined using Kadane's Algorithm?

    1. 2
    2. 5
    3. 4
    4. 6
    5. 7
  10. String Reversal In-Place

    What is the result after reversing the string array ['H','e','l','l','o'] in-place using the two pointer technique?

    1. ['e','l','l','o','H']
    2. ['o','l','l','H','e']
    3. ['o','l','l','e','H']
    4. ['l','e','o','l','H']
    5. ['H','l','l','e','o']