Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
26 views2 pages

Top Array Questions for SDE 3 Interviews

Jebrbrj krkrjrbehdkr krjrbrbekrn

Uploaded by

deepshiva1012
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views2 pages

Top Array Questions for SDE 3 Interviews

Jebrbrj krkrjrbehdkr krjrbrbekrn

Uploaded by

deepshiva1012
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Most Asked Questions on Arrays for SDE 3

1. Advanced Sorting and Searching


 Implement a custom comparator to sort an array based on complex conditions.
 Find the kth smallest/largest element in an unsorted array (using Quickselect or heaps).
 Search in a sorted and rotated array (with duplicates).
 Given an almost-sorted array (elements at most k away from the correct position), sort
it efficiently.

2. Subarrays and Subsequences


 Find the maximum sum subarray (Kadane's algorithm) and extend it to 2D matrices.
 Count the number of subarrays with a given sum (using hashmaps).
 Find the longest subarray with equal numbers of 0s and 1s.
 Count all subarrays having product less than K.
 Find the smallest subarray with a sum greater than or equal to K.

3. Two-Pointer and Sliding Window Problems


 Find all unique triplets in an array that sum to zero.
 Find the longest substring with at most K distinct characters.
 Find the minimum window substring containing all characters of another string.
 Merge two sorted arrays in place without extra space.
 Remove duplicates from a sorted array while allowing at most k occurrences of each
element.

4. Arrays with Mathematical Properties


 Find all pairs in an array such that their sum is equal to a given number (with and
without sorting).
 Solve the 3Sum, 4Sum, or kSum problem.
 Check if an array contains a subarray with a sum divisible by K.
 Find the majority element (appearing more than n/2 or n/3 times) using Boyer-Moore
Voting Algorithm.
 Find the next permutation of an array.

5. Optimization Problems
 Maximum product subarray.
 Maximum difference between two elements (arr[j] - arr[i]) such that j > i.
 Find the maximum sum of i * arr[i] after rotations.
 Find the minimum number of swaps required to sort an array.
 Implement an online median finder (median of a data stream).

6. Matrix Manipulation
 Rotate a matrix by 90 degrees in place.
 Find the longest increasing path in a matrix.
 Search for an element in a row-wise and column-wise sorted matrix.
 Find the maximum sum rectangle in a 2D array.
 Perform spiral traversal of a matrix.

7. Problem-Solving with Data Structures


 Design a data structure that supports insert, delete, and getRandom in O(1).
 Implement a prefix sum array or difference array for range queries.
 Use Fenwick Tree or Segment Tree for range-based problems.
 Merge overlapping intervals.
 Solve a problem involving sparse arrays.

8. Greedy and Dynamic Programming with Arrays


 Solve the partition problem (divide the array into two subsets of equal sum).
 Minimum number of jumps to reach the end of an array.
 Find the largest divisible subset.
 Solve the trap rainwater problem.
 Solve the candy distribution problem.

9. Miscellaneous
 Find the minimum missing positive integer in an unsorted array.
 Rearrange an array to have positive and negative numbers alternate.
 Implement merge intervals with maximum overlap count.
 Check if the array can be split into consecutive subsequences.
 Sort an array of 0s, 1s, and 2s (Dutch National Flag Problem).

You might also like