Meta

Alien Dictionary

Given a sorted dictionary of alien language, find the order of characters in the alien alphabet

All Paths From Source to Target

Find all possible paths from source node to target node in a directed acyclic graph (DAG)

Articulation Points (Cut Vertices)

Find all articulation points in an undirected graph - vertices whose removal increases the number of connected components

Bellman-Ford Algorithm

Find shortest paths from a source vertex to all other vertices in a weighted graph, capable of handling negative edge weights

BFS Shortest Path in Unweighted Graph

Find shortest path between two vertices in an unweighted graph using BFS traversal

Check if Array is Sorted

Determine if an array is sorted in ascending, descending, or not sorted at all

Clone Graph

Create a deep copy of an undirected graph represented with adjacency lists

Connect Ropes with Minimum Cost

Connect ropes with minimum cost using greedy approach with heap

Course Schedule

Determine if you can finish all courses given prerequisite relationships using topological sorting

Depth-First Search (DFS)

Implement depth-first search traversal for graphs

Find Bridges in a Graph

Find all bridges (critical edges) in an undirected graph using Tarjan's algorithm

Find Duplicate Number

Find the duplicate number in an array containing n+1 integers where each integer is between 1 and n (inclusive)

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 Median from Data Stream

Design data structure to find median from continuous stream of integers

Find the Maximum Element in an Array

Find and return the largest element in an array of integers

Find the Second Largest Element in an Array

Find and return the second largest element in an array of integers

Floyd-Warshall Algorithm - All Pairs Shortest Path

Find shortest paths between all pairs of vertices in a weighted graph using dynamic programming

Furthest Building You Can Reach

Find furthest building reachable using optimal allocation of bricks and ladders

Implement Stack

Design and implement a stack data structure with push, pop, top, and empty operations

Is Graph Bipartite

Check if a graph can be colored with exactly two colors such that no two adjacent nodes have the same color

Kth Largest Element in Array

Find the kth largest element in an unsorted array

Kth Smallest Element in Sorted Matrix

Find kth smallest element in row and column sorted matrix using heap

Largest Rectangle in Histogram

Find the largest rectangle that can be formed in a histogram

Longest Palindromic Substring

Find the longest palindromic substring in a given string

Longest Substring Without Repeating Characters

Find the length of the longest substring without repeating characters

Maximize Sum After K Negations

Maximize array sum by flipping signs of k elements using greedy heap approach

Meeting Rooms II

Find minimum number of meeting rooms required using heap

Merge K Sorted Arrays

Merge k sorted arrays into one sorted array using heap

Merge Two Sorted Arrays

Merge two sorted arrays into a single sorted array in-place

Min Stack

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time

Minimum Number of Refueling Stops

Find minimum refueling stops to reach target using greedy max-heap approach

Minimum Spanning Tree

Find the minimum spanning tree of a weighted undirected graph using Kruskal's and Prim's algorithms

Minimum Window Substring

Find the minimum window substring that contains all characters of another string

Move All Zeros to the End

Move all zeros in an array to the end while maintaining the relative order of non-zero elements

Network Delay Time (Dijkstra's Algorithm)

Find the time it takes for a signal to reach all nodes in a network using shortest path algorithms

Reduce Array Size to Half

Find minimum removals to reduce array size by half using greedy heap approach

Regular Expression Matching

Implement regular expression matching with support for '.' and '*'

Reorganize String

Reorganize string so no two adjacent characters are the same

Reverse an Array

Reverse the order of elements in an array in-place and return the modified array

Rotate Array by K Steps

Rotate an array to the right by k steps where k is non-negative

Rotten Oranges Problem

Find the minimum time for all oranges to rot using BFS

Serialize and Deserialize Binary Tree

Serialize a binary tree to a string and deserialize it back to the original tree

Sliding Window Maximum

Find the maximum element in each sliding window of size k

Sliding Window Median

Find median in each sliding window using two heaps

Smallest Substring with All Characters

Find the smallest substring that contains all characters of a given pattern

Sort Characters by Frequency

Sort characters in string by frequency using heap or bucket sort

Stock Span Problem

Calculate the span of stock prices for each day

Task Scheduler

Schedule tasks with cooling period using greedy approach with heap

Top K Frequent Elements

Find the k most frequent elements in an array

Trapping Rain Water

Calculate how much rainwater can be trapped between bars of different heights

Ugly Numbers (Heap-based)

Find the nth ugly number using heap-based approach

Valid Anagram

Determine if two strings are anagrams of each other

Valid Parentheses

Determine if the input string has valid brackets that are properly opened and closed

Vertical Order Traversal of Binary Tree

Traverse a binary tree vertically and return nodes by columns

Word Ladder

Find the shortest transformation sequence from beginWord to endWord using single character changes

Zigzag Level Order Traversal

Traverse a binary tree level by level in zigzag order