LEETCODE HotList Questions
📍Arrays and Strings
1. Two Sum (LeetCode 1)
2. Longest Substring Without Repeating Characters (LeetCode 3)
3. Product of Array Except Self (LeetCode 238)
4. Maximum Subarray (LeetCode 53)
5. Merge Intervals (LeetCode 56)
6. Rotate Array – https://lnkd.in/d3iAd_ye
7. Best Time to Buy and Sell Stock – https://lnkd.in/dbfXdHcc
Strings
Reverse String – https://lnkd.in/dSYxrHkt
→ Valid Palindrome – https://lnkd.in/dNTpQFit
→ Longest Substring Without Repeating Characters – https://lnkd.in/dMYzuAY4
→ Longest Palindromic Substring – https://lnkd.in/dnk7bi7m
📍Linked Lists
1. Reverse Linked List (LeetCode 206)
2. Merge Two Sorted Lists (LeetCode 21)
3. Detect Cycle in a Linked List (LeetCode 141)
4. Remove Nth Node From End of List (LeetCode 19)
📍Stacks and Queues
1. Valid Parentheses (LeetCode 20)
2. Implement Queue using Stacks (LeetCode 232)
3. Min Stack (LeetCode 155)
4. Largest Rectangle in Histogram (LeetCode 84)
5. Sliding Window Maximum (LeetCode 239)
📍Trees
1. Binary Tree Inorder Traversal (LeetCode 94)
2. Validate Binary Search Tree (LeetCode 98)
3. Lowest Common Ancestor of a Binary Search Tree (LeetCode 235)
4. Binary Tree Maximum Path Sum (LeetCode 124)
📍Graphs
1. Clone Graph (LeetCode 133)
2. Course Schedule (LeetCode 207)
3. Number of Islands (LeetCode 200)
4. Graph Valid Tree (LeetCode 261)
5. Word Ladder (LeetCode 127)
📍Heaps
1. Merge k Sorted Lists (LeetCode 23)
2. Top K Frequent Elements (LeetCode 347)
3. Find Median from Data Stream (LeetCode 295)
4. Kth Largest Element in an Array (LeetCode 215)
5. Sliding Window Median (LeetCode 480)
📍Dynamic Programming
1. Climbing Stairs (LeetCode 70)
2. Longest Increasing Subsequence (LeetCode 300)
3. Coin Change (LeetCode 322)
4. Longest Common Subsequence (LeetCode 1143)
5. Edit Distance (LeetCode 72)
📍Backtracking
1. Subsets (LeetCode 78)
2. Permutations (LeetCode 46)
3. Combination Sum (LeetCode 39)
4. N-Queens (LeetCode 51)
5. Word Search (LeetCode 79)
📍Greedy Algorithms
1. Gas Station (LeetCode 134)
2. Jump Game (LeetCode 55)
3. Partition Labels (LeetCode 763)
4. Minimum Number of Arrows to Burst Balloons (LeetCode 452)
5. Assign Cookies (LeetCode 455)
📍Divide and Conquer
1. Merge Sort
2. Quick Sort
3. Kth Largest Element in an Array (LeetCode 215)
4. Find Peak Element (LeetCode 162)
5. Majority Element (LeetCode 169)
list array question
- Find the maximum element in an array.
Technique: Iteration through the array. - Find the minimum element in an array.
Technique: Iteration through the array. - Calculate the sum of all elements in an array.
Technique: Iteration through the array. - Reverse an array.
Technique: Two-pointer approach or iterative swapping. - Check if an array is sorted.
Technique: Iteration through the array. - Remove duplicates from a sorted array.
Technique: Two-pointer approach. - Rotate an array to the right by k steps.
Technique: Basic array manipulation. - Implement an algorithm to find the “Kth” largest element in an array.
Technique: Sorting or use of max heap. - Implement an algorithm to find the “Kth” smallest element in an array.
Technique: Sorting or use of min heap. - Move all zeroes to the end of the array.
Technique: Two-pointer approach.
Intermediate Level: - Implement an algorithm to rotate an NxN matrix by 90 degrees.
Technique: Transpose and reverse or use of extra space. - Implement an algorithm to find pairs in an array that sum up to a specific target.
Technique: Two-pointer approach or hash table. - Implement an algorithm to perform a cyclic rotation in a given array.
Technique: Cyclic Sort. - Find the “celebrity” in a party using a given array of people.
Technique: Two-pointer approach. - Implement an algorithm to find the contiguous subarray with the largest sum (Kadane’s algorithm).
Technique: Dynamic Programming. - Implement an algorithm to merge two sorted arrays.
Technique: Merge Sort or Two-pointer approach. - Implement an algorithm to search for an element in a rotated sorted array.
Technique: Modified Binary Search. - Implement an algorithm to find the intersection of two arrays.
Technique: Hashing or Two-pointer approach. - Implement an algorithm to find the majority element in an array.
Technique: Boyer-Moore Voting Algorithm. - Implement an algorithm to find the longest increasing subsequence in an array.
Technique: Dynamic Programming.
Advanced Level: - Implement an algorithm to find the first missing positive integer in an unsorted array.
Technique: Cyclic Sort. - Implement an algorithm to sort an array of 0s, 1s, and 2s (Dutch National Flag problem).
Technique: Dutch National Flag algorithm or Two-pointer approach. - Implement an algorithm to find the longest subarray with at most two distinct elements.
Technique: Sliding Window. - Implement an algorithm to find the median of two sorted arrays.
Technique: Binary Search. - Implement an algorithm to rotate an array to the right by k steps without using extra space.
Technique: Reverse the array in parts. - Implement an algorithm to find the shortest subarray with a sum at least K.
Technique: Sliding Window. - Implement an algorithm to find the equilibrium index of an array.
Technique: Prefix Sum. - Implement an algorithm to find the peak element in an array.
Technique: Binary Search. - Implement an algorithm to count the number of subarrays with a given sum.
Technique: Prefix Sum. - Implement an algorithm to find the contiguous subarray with equal numbers of 0s and 1s.
Technique: Prefix Sum or Hashing.
Expert Level - Implement an algorithm to efficiently find the maximum product of three numbers in an array.
Technique: Sorting or finding max/min elements. - Implement an algorithm to find the length of the longest subarray with sum divisible by k.
Technique: Prefix Sum and Hashing. - Implement an algorithm to find the minimum window in an array that contains all elements of another array.
Technique: Sliding Window. - Implement an algorithm to find the longest increasing subarray with absolute difference less than or equal to a given number.
Technique: Sliding Window. - Implement an algorithm to find the smallest subarray with sum greater than a given value.
Technique: Sliding Window. - Implement an algorithm to find the minimum number of platforms needed for a set of train arrivals and departures.
Technique: Merge Intervals or Sorting. - Implement an algorithm to find the maximum length subarray with sum less than or equal to a given sum.
Technique: Sliding Window. - Implement an algorithm to find the subarray with the least average.
Technique: Sliding Window. - Implement an algorithm to efficiently rotate an NxN matrix by 90 degrees in place.
Technique: Transpose and reverse. - Implement an algorithm to find the longest subarray with at most K distinct elements.
Technique: Sliding Window or Hashing.