Sorting

Sum of Mutated Array Closest to Target

LeetCode problem #1300

Sorting & Searching

Master fundamental sorting and searching algorithms and their applications.

Combination Sum

Given an array of distinct integers and a target, return all unique combinations where the chosen numbers sum to target (elements may be reused)

Find K Largest Elements

Find the k largest elements from an unsorted array

Find K Smallest Elements

Find the k smallest elements from an unsorted array

Find Missing Number (1 to n)

Find the missing number in an array containing n distinct numbers taken from 1, 2, 3, ..., n+1

Group Anagrams

Given an array of strings, group the anagrams together.

Group Anagrams

Group strings that are anagrams of each other together.

Intersection of Two Arrays

Find the intersection of two arrays and return the result as an array.

Kth Largest Element in an Array

Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.

Kth Largest Element in Array

Find the kth largest element in an unsorted array

Longest Consecutive Sequence

Find the length of the longest consecutive elements sequence in an unsorted array.

Merge Intervals

Given an array of intervals where intervals[i] = [start_i, end_i], merge all overlapping intervals and return an array of the non-overlapping intervals that cover all the intervals in the input.

Merge K Sorted Arrays

Merge k sorted arrays into one sorted array using heap

Merge Two Sorted Arrays (LC 88) — Two Pointers

LeetCode 88 merge sorted array in-place: reverse two pointers (merge from end) in O(m+n) time, O(1) space. Step-by-step + examples.

Minimum Number of Platforms

Given arrival and departure times of trains at a station, find the minimum number of platforms required so that no train is kept waiting

Minimum Swaps to Sort Array

Find the minimum number of swaps required to sort an array.

Sort Linked List

Sort a linked list in O(n log n) time using constant extra space

Task Scheduler

Find the minimum number of intervals the CPU will take to finish all given tasks with a cooldown period between identical tasks

Three Sum (Triplets that Sum to Zero)

Find all unique triplets in the array which gives the sum of zero

Valid Anagram

Given two strings, determine if one is an anagram of the other.

Valid Anagram

Determine if two strings are anagrams of each other

Vertical Order Traversal of Binary Tree

Traverse a binary tree vertically and return nodes by columns