Binary Tree Traversals

Medium
13 views 22 Dec 2025
Perform inorder, preorder, and postorder traversals of a binary tree....

Level Order Traversal

Medium
14 views 22 Dec 2025
Traverse a binary tree level by level using a queue....

Height of Binary Tree

Medium
10 views 22 Dec 2025
Find the height of a binary tree using recursion....

Count Nodes in Binary Tree

Medium
13 views 22 Dec 2025
Count the total number of nodes in a binary tree....

Count Leaf Nodes

Medium
14 views 22 Dec 2025
Count the number of leaf nodes in a binary tree....

Mirror of Binary Tree

Medium
12 views 22 Dec 2025
Convert a binary tree into its mirror image....

Diameter of Binary Tree

Medium
15 views 22 Dec 2025
Find the diameter (longest path) of a binary tree....

Check Balanced Binary Tree

Medium
12 views 22 Dec 2025
Check whether a binary tree is height-balanced....

Lowest Common Ancestor

Medium
18 views 22 Dec 2025
Find the lowest common ancestor of two nodes in a binary tree....

Binary Search Tree Properties

Medium
17 views 22 Dec 2025
Explain properties of a Binary Search Tree....

Search in Binary Search Tree

Medium
13 views 22 Dec 2025
Search for a value in a Binary Search Tree....

Insert in Binary Search Tree

Medium
16 views 22 Dec 2025
Insert a new node into a Binary Search Tree....

Delete in Binary Search Tree

Medium
17 views 22 Dec 2025
Delete a node from a Binary Search Tree while maintaining its properties....

Validate Binary Search Tree

Medium
16 views 22 Dec 2025
Check whether a given binary tree is a valid Binary Search Tree....

Kth Smallest Element in BST

Medium
15 views 22 Dec 2025
Find the kth smallest element in a Binary Search Tree....

Convert Sorted Array to BST

Medium
13 views 22 Dec 2025
Convert a sorted array into a height-balanced Binary Search Tree....

Boundary Traversal of Binary Tree

Medium
16 views 22 Dec 2025
Perform boundary traversal of a binary tree....

Vertical Order Traversal

Medium
19 views 22 Dec 2025
Print the vertical order traversal of a binary tree....

Introduction to Trees

Medium
14 views 22 Dec 2025
Explain what a tree data structure is and how it differs from linear data structures....

Types of Trees

Medium
13 views 22 Dec 2025
Explain different types of trees such as binary tree, binary search tree, AVL tree, and heap....

Introduction to Stack

Medium
15 views 22 Dec 2025
Explain what a stack data structure is and how it follows the LIFO principle....

Stack Operations

Medium
15 views 22 Dec 2025
Explain basic stack operations such as push, pop, peek, and isEmpty....

Stack Implementation Using Array

Medium
10 views 22 Dec 2025
Implement a stack using an array and explain how overflow and underflow occur....

Stack Implementation Using Linked List

Medium
15 views 22 Dec 2025
Implement a stack using linked list and explain dynamic memory usage....

Check Balanced Parentheses

Medium
11 views 22 Dec 2025
Check whether an expression has balanced parentheses using stack....

Reverse a String Using Stack

Medium
12 views 22 Dec 2025
Reverse a string using stack and explain the process step by step....

Infix to Postfix Conversion

Medium
12 views 22 Dec 2025
Convert an infix expression to postfix using stack....

Evaluate Postfix Expression

Medium
12 views 22 Dec 2025
Evaluate a postfix expression using stack....

Next Greater Element

Medium
10 views 22 Dec 2025
Find the next greater element for each element in an array using stack....

Previous Smaller Element

Medium
13 views 22 Dec 2025
Find the previous smaller element for each element using stack....

Stock Span Problem

Medium
13 views 22 Dec 2025
Solve the stock span problem using stack and explain the logic....

Largest Rectangle in Histogram

Medium
14 views 22 Dec 2025
Find the largest rectangular area in a histogram using stack....

Implement Queue Using Stack

Medium
14 views 22 Dec 2025
Implement a queue using stack and explain the approach....

Implement Stack Using Queue

Medium
13 views 22 Dec 2025
Implement a stack using queue and explain the approach....

Check Palindrome Using Stack

Medium
13 views 22 Dec 2025
Check whether a string is palindrome using stack....

Sort a Stack

Medium
13 views 22 Dec 2025
Sort a stack using recursion or another stack....

Minimum Element in Stack

Medium
14 views 22 Dec 2025
Design a stack that supports getMin operation in O(1) time....

Remove Adjacent Duplicates

Medium
9 views 22 Dec 2025
Remove adjacent duplicate characters from a string using stack....

Decode String

Medium
14 views 22 Dec 2025
Decode an encoded string using stack....

Celebrity Problem

Medium
15 views 22 Dec 2025
Find the celebrity in a party using stack approach....

Bubble Sort

Medium
14 views 22 Dec 2025
Sort an array using Bubble Sort and explain how adjacent elements are repeatedly swapped to move the largest element to the end....

Selection Sort

Medium
14 views 22 Dec 2025
Sort an array using Selection Sort by repeatedly selecting the minimum element and placing it at the correct position....

Insertion Sort

Medium
15 views 22 Dec 2025
Sort an array using Insertion Sort and explain how elements are inserted into their correct position....

Merge Sort

Medium
15 views 22 Dec 2025
Sort an array using Merge Sort by dividing the array into halves and merging sorted subarrays....

Quick Sort

Medium
13 views 22 Dec 2025
Sort an array using Quick Sort and explain pivot selection and partitioning....

Heap Sort

Medium
14 views 22 Dec 2025
Sort an array using Heap Sort and explain heap construction and extraction....

Counting Sort

Medium
13 views 22 Dec 2025
Sort elements using Counting Sort when the range of input values is known....

Radix Sort

Medium
13 views 22 Dec 2025
Sort numbers using Radix Sort by processing digits from least to most significant....

Bucket Sort

Medium
13 views 22 Dec 2025
Sort elements by distributing them into buckets and sorting each bucket individually....

Shell Sort

Medium
11 views 22 Dec 2025
Sort an array using Shell Sort and explain gap reduction....

Tim Sort

Medium
11 views 22 Dec 2025
Explain Tim Sort algorithm used in Python and Java and why it is efficient in practice....

Stable vs Unstable Sorting

Medium
15 views 22 Dec 2025
Differentiate between stable and unstable sorting algorithms with examples....

In-Place Sorting

Medium
11 views 22 Dec 2025
Explain in-place sorting algorithms and their advantages....

Sort Nearly Sorted Array

Medium
12 views 22 Dec 2025
Sort an array where each element is at most k positions away from its sorted position....

Sort Array of 0s 1s and 2s

Medium
17 views 22 Dec 2025
Sort an array containing only 0s, 1s, and 2s using the Dutch National Flag algorithm....

Merge Two Sorted Arrays

Medium
15 views 22 Dec 2025
Merge two already sorted arrays into a single sorted array efficiently....

Count Inversions

Medium
15 views 22 Dec 2025
Count the number of inversions in an array using a modified merge sort....

Minimum Swaps to Sort Array

Medium
13 views 22 Dec 2025
Find the minimum number of swaps required to sort an array....

Kth Smallest Element

Medium
15 views 22 Dec 2025
Find the kth smallest element in an unsorted array using sorting or selection techniques....

Sort Strings Lexicographically

Medium
13 views 22 Dec 2025
Sort an array of strings in lexicographical order using suitable sorting approach....

Linear Search

Medium
16 views 22 Dec 2025
Search for an element in an array by checking each element sequentially and explain when this approach is useful....

Binary Search

Medium
11 views 22 Dec 2025
Search for an element in a sorted array by repeatedly dividing the search space into halves....

Binary Search Iterative

Medium
14 views 22 Dec 2025
Implement binary search using an iterative approach and explain its working....

Binary Search Recursive

Medium
19 views 22 Dec 2025
Implement binary search using recursion and explain the recursive flow....

Search in Rotated Sorted Array

Medium
11 views 22 Dec 2025
Search for a target element in a rotated sorted array using modified binary search....

First and Last Occurrence

Medium
16 views 22 Dec 2025
Find the first and last occurrence of a target element in a sorted array....

Count Occurrences

Medium
15 views 22 Dec 2025
Count the number of occurrences of an element in a sorted array using binary search....

Find Peak Element

Medium
16 views 22 Dec 2025
Find a peak element in an array where an element is greater than its neighbors....

Jump Search

Medium
19 views 22 Dec 2025
Search an element in a sorted array using jump search technique....

Interpolation Search

Medium
16 views 22 Dec 2025
Search for an element in a sorted uniformly distributed array using interpolation search....

Exponential Search

Medium
16 views 22 Dec 2025
Search for an element in a sorted array using exponential search followed by binary search....

Ternary Search

Medium
13 views 22 Dec 2025
Find the maximum or minimum of a unimodal function using ternary search....

Search in Infinite Sorted Array

Medium
17 views 22 Dec 2025
Search for an element in an infinite sorted array by expanding search range....

Search in Nearly Sorted Array

Medium
21 views 22 Dec 2025
Search an element in a nearly sorted array where elements may be misplaced by one index....

Lower Bound

Medium
15 views 22 Dec 2025
Find the lower bound of a target element in a sorted array....

Upper Bound

Medium
16 views 22 Dec 2025
Find the upper bound of a target element in a sorted array....

Search in Bitonic Array

Medium
18 views 22 Dec 2025
Search an element in a bitonic array using binary search variants....

Square Root Using Binary Search

Medium
15 views 22 Dec 2025
Find the integer square root of a number using binary search....

Allocate Minimum Pages

Medium
15 views 22 Dec 2025
Allocate minimum number of pages to students using binary search on answer....

Aggressive Cows Problem

Medium
21 views 22 Dec 2025
Place cows in stalls such that minimum distance is maximized using binary search on answer....

Introduction to Queue

Medium
14 views 22 Dec 2025
Explain what a queue data structure is and how it follows the FIFO principle....

Types of Queues

Medium
13 views 22 Dec 2025
Explain different types of queues such as simple queue, circular queue, priority queue, and deque....

Queue Implementation Using Array

Medium
12 views 22 Dec 2025
Implement a queue using an array and explain enqueue and dequeue operations....

Queue Implementation Using Linked List

Medium
14 views 22 Dec 2025
Implement a queue using linked list and explain how pointers are managed....

Circular Queue

Medium
13 views 22 Dec 2025
Explain circular queue and how it overcomes limitations of simple queue....

Enqueue Operation

Medium
14 views 22 Dec 2025
Explain enqueue operation in a queue with step-by-step process....

Dequeue Operation

Medium
12 views 22 Dec 2025
Explain dequeue operation in a queue and how underflow is handled....

Front and Rear Pointers

Medium
14 views 22 Dec 2025
Explain the role of front and rear pointers in queue operations....

Queue Overflow and Underflow

Medium
15 views 22 Dec 2025
Explain queue overflow and underflow conditions with examples....

Priority Queue

Medium
12 views 22 Dec 2025
Explain priority queue and its real-world applications....

Deque (Double Ended Queue)

Medium
12 views 22 Dec 2025
Explain deque and its operations at both ends....

Implement Stack Using Queue

Medium
13 views 22 Dec 2025
Implement a stack using queue and explain the logic....

Implement Queue Using Stack

Medium
15 views 22 Dec 2025
Implement a queue using stack and explain the approach....

Reverse Queue

Medium
15 views 22 Dec 2025
Reverse the elements of a queue using recursion or stack....

Queue Using Circular Array

Medium
13 views 22 Dec 2025
Design a queue using circular array with proper conditions....

First Non-Repeating Character in Stream

Medium
13 views 22 Dec 2025
Find the first non-repeating character in a stream of characters using queue....

Sliding Window Maximum

Medium
11 views 22 Dec 2025
Find the maximum element in every sliding window using deque....

Interleave First and Second Half

Medium
12 views 22 Dec 2025
Interleave the first half and second half of a queue....

Generate Binary Numbers

Medium
12 views 22 Dec 2025
Generate binary numbers from 1 to N using queue....

LRU Cache Using Queue Concept

Medium
15 views 22 Dec 2025
Explain how queue concept is used in LRU cache design....

Introduction to Linked List

Medium
13 views 22 Dec 2025
Explain what a linked list is and how it differs from an array in terms of memory and operations....

Types of Linked Lists

Medium
13 views 22 Dec 2025
Explain different types of linked lists such as singly, doubly, and circular linked lists....

Traversal of Linked List

Medium
13 views 22 Dec 2025
Traverse a singly linked list and explain how nodes are accessed sequentially....

Insert Node at Beginning

Medium
13 views 22 Dec 2025
Insert a new node at the beginning of a singly linked list and explain pointer changes....

Insert Node at End

Medium
15 views 22 Dec 2025
Insert a node at the end of a linked list and describe the steps involved....

Insert Node at Given Position

Medium
10 views 22 Dec 2025
Insert a node at a specific position in a linked list....

Delete Node from Beginning

Medium
18 views 22 Dec 2025
Delete the first node of a linked list and explain memory handling....

Delete Node from End

Medium
16 views 22 Dec 2025
Delete the last node of a linked list and explain traversal logic....

Delete Node with Given Value

Medium
12 views 22 Dec 2025
Delete a node containing a specific value from a linked list....

Search an Element

Medium
15 views 22 Dec 2025
Search for an element in a linked list and return its position....

Reverse a Linked List

Medium
12 views 22 Dec 2025
Reverse a singly linked list iteratively and explain pointer manipulation....

Reverse Linked List Recursively

Medium
11 views 22 Dec 2025
Reverse a linked list using recursion and explain the recursive flow....

Find Middle of Linked List

Medium
12 views 22 Dec 2025
Find the middle node of a linked list using slow and fast pointers....

Detect Loop in Linked List

Medium
15 views 22 Dec 2025
Detect whether a linked list contains a loop using Floyd’s cycle detection algorithm....

Remove Loop from Linked List

Medium
14 views 22 Dec 2025
Remove a loop from a linked list once it is detected....

Merge Two Sorted Linked Lists

Medium
14 views 22 Dec 2025
Merge two sorted linked lists into one sorted list....

Find Intersection Point

Medium
12 views 22 Dec 2025
Find the intersection point of two linked lists....

Check Palindrome Linked List

Medium
14 views 22 Dec 2025
Check whether a linked list is a palindrome....

Rotate Linked List

Medium
12 views 22 Dec 2025
Rotate a linked list by k positions....

Flatten a Linked List

Medium
17 views 22 Dec 2025
Flatten a multilevel linked list into a single linked list....

What is a Heap

Medium
11 views 22 Dec 2025
Explain what a heap data structure is and how it maintains the heap property....

Min Heap vs Max Heap

Medium
17 views 22 Dec 2025
Explain the difference between Min Heap and Max Heap with use cases....

Build Heap from Array

Medium
12 views 22 Dec 2025
Build a heap from an unsorted array and explain the time complexity....

Heap Sort

Medium
15 views 22 Dec 2025
Sort an array using heap sort algorithm and explain its working....

Priority Queue Using Heap

Medium
13 views 22 Dec 2025
Implement a priority queue using heap and explain its operations....

Kth Largest Element

Medium
13 views 22 Dec 2025
Find the kth largest element in an array using a heap....

Kth Smallest Element

Medium
14 views 22 Dec 2025
Find the kth smallest element in an array using a heap....

Merge K Sorted Arrays

Medium
10 views 22 Dec 2025
Merge k sorted arrays into one sorted array using heap....

Top K Frequent Elements

Medium
14 views 22 Dec 2025
Find the top k most frequent elements using heap....

Median of Data Stream

Medium
15 views 22 Dec 2025
Find the median of a data stream using two heaps....

Sort Nearly Sorted Array

Medium
11 views 22 Dec 2025
Sort a nearly sorted array where each element is at most k away from its target position....

Minimum Cost to Connect Ropes

Medium
12 views 22 Dec 2025
Connect ropes with minimum cost using a min heap....

Find K Closest Points

Medium
14 views 22 Dec 2025
Find k closest points to origin using heap....

Reorganize String

Medium
14 views 22 Dec 2025
Reorganize string so that no two adjacent characters are same using heap....

Sliding Window Maximum

Medium
14 views 22 Dec 2025
Find maximum in every sliding window of size k using heap....

Smallest Range Covering K Lists

Medium
16 views 22 Dec 2025
Find the smallest range that includes at least one number from each of the k lists using heap....

What is Hashing

Medium
13 views 22 Dec 2025
Explain hashing and why hash tables are used for efficient data storage and retrieval....

Hash Table Implementation

Medium
12 views 22 Dec 2025
Design a basic hash table and explain how keys are mapped to indices....

Collision Handling Techniques

Medium
14 views 22 Dec 2025
Explain different collision handling techniques such as chaining and open addressing....

Chaining in Hashing

Medium
16 views 22 Dec 2025
Explain separate chaining technique with an example....

Linear Probing

Medium
13 views 22 Dec 2025
Explain linear probing for collision resolution in hashing....

Quadratic Probing

Medium
13 views 22 Dec 2025
Describe quadratic probing and how it reduces clustering compared to linear probing....

Double Hashing

Medium
13 views 22 Dec 2025
Explain double hashing and why it is considered better than other probing methods....

Load Factor

Medium
16 views 22 Dec 2025
Define load factor in hashing and explain its impact on performance....

Rehashing

Medium
14 views 22 Dec 2025
Explain rehashing and when it is required....

Find Frequency of Elements

Medium
14 views 22 Dec 2025
Find the frequency of each element in an array using hashing....

Check Duplicate Elements

Medium
16 views 22 Dec 2025
Check whether an array contains duplicate elements using hashing....

First Non-Repeating Element

Medium
17 views 22 Dec 2025
Find the first non-repeating element in an array using hashing....

Two Sum Problem

Medium
13 views 22 Dec 2025
Find two numbers in an array that add up to a target sum using hashing....

Subarray with Zero Sum

Medium
14 views 22 Dec 2025
Check whether a subarray with zero sum exists using hashing....

Longest Subarray with Given Sum

Medium
17 views 22 Dec 2025
Find the longest subarray with a given sum using hashing....

Intersection of Two Arrays

Medium
16 views 22 Dec 2025
Find the intersection of two arrays using hashing....

Union of Two Arrays

Medium
17 views 22 Dec 2025
Find the union of two arrays using hashing....

Longest Consecutive Sequence

Medium
14 views 22 Dec 2025
Find the length of the longest consecutive elements sequence using hashing....

Group Anagrams

Medium
17 views 22 Dec 2025
Group strings that are anagrams using hashing....

Check Isomorphic Strings

Medium
14 views 22 Dec 2025
Check whether two strings are isomorphic using hashing....

Activity Selection Problem

Medium
14 views 22 Dec 2025
Given start and finish times of activities select the maximum number of activities that can be performed by a single person using a greedy strategy....

Fractional Knapsack

Medium
16 views 22 Dec 2025
Given weights and values of items determine the maximum value that can be obtained by taking fractions of items using greedy approach....

Minimum Number of Coins

Medium
13 views 22 Dec 2025
Given coin denominations find the minimum number of coins required to make a given amount using greedy method....

Job Sequencing with Deadlines

Medium
15 views 22 Dec 2025
Given jobs with deadlines and profits schedule jobs to maximize total profit using greedy strategy....

Huffman Coding

Medium
14 views 22 Dec 2025
Construct a Huffman tree to generate optimal prefix codes for characters based on their frequencies....

Minimum Platforms Problem

Medium
19 views 22 Dec 2025
Given arrival and departure times of trains find the minimum number of platforms required so that no train waits....

Gas Station Problem

Medium
13 views 22 Dec 2025
Given gas stations in a circular route determine if you can complete the circuit starting from a station using greedy logic....

Candy Distribution

Medium
14 views 22 Dec 2025
Distribute candies to children based on ratings such that conditions are satisfied using greedy approach....

Interval Scheduling

Medium
15 views 22 Dec 2025
Select the maximum number of non-overlapping intervals using greedy technique....

Connect Ropes with Minimum Cost

Medium
15 views 22 Dec 2025
Given ropes of different lengths connect them with minimum cost using greedy strategy....

Assign Cookies

Medium
14 views 22 Dec 2025
Assign cookies to children to maximize contentment using greedy method....

Minimum Absolute Difference

Medium
13 views 22 Dec 2025
Find pairs with minimum absolute difference using sorting and greedy approach....

Boat Rescue Problem

Medium
14 views 22 Dec 2025
Determine minimum number of boats required to rescue people based on weight limit using greedy approach....

Rearrange Characters

Medium
13 views 22 Dec 2025
Rearrange characters in a string so that no two adjacent characters are the same using greedy strategy....

Valid Parenthesis String

Medium
15 views 22 Dec 2025
Check if a string with wildcard characters can be valid parentheses using greedy technique....

Maximum Length Chain of Pairs

Medium
14 views 22 Dec 2025
Find the maximum length chain of pairs using greedy approach similar to activity selection....

Minimum Number of Arrows

Medium
15 views 22 Dec 2025
Find the minimum number of arrows to burst balloons represented as intervals using greedy approach....

Partition Labels

Medium
13 views 22 Dec 2025
Partition a string into as many parts as possible so that each letter appears in at most one part using greedy logic....

Buy and Sell Stock II

Medium
14 views 22 Dec 2025
Maximize profit by making multiple stock buy and sell transactions using greedy approach....

Largest Number Formation

Medium
12 views 22 Dec 2025
Arrange numbers to form the largest possible number using greedy comparison....

Graph Basics and Terminology

Medium
17 views 22 Dec 2025
Explain basic graph terminology including vertices, edges, degree, path, cycle, and connected components with simple examples....

Types of Graphs

Medium
14 views 22 Dec 2025
Describe different types of graphs such as directed, undirected, weighted, unweighted, cyclic, and acyclic graphs....

Graph Representation Using Adjacency List

Medium
15 views 22 Dec 2025
Represent a graph using an adjacency list and explain why it is memory efficient for sparse graphs....

Graph Representation Using Adjacency Matrix

Medium
15 views 22 Dec 2025
Represent a graph using an adjacency matrix and discuss its advantages and disadvantages....

Breadth First Search Traversal

Medium
13 views 22 Dec 2025
Traverse a graph using BFS and explain how the queue data structure is used....

Depth First Search Traversal

Medium
15 views 22 Dec 2025
Traverse a graph using DFS and explain the recursive approach....

Detect Cycle in Undirected Graph

Medium
21 views 22 Dec 2025
Detect whether an undirected graph contains a cycle using DFS or BFS....

Detect Cycle in Directed Graph

Medium
16 views 22 Dec 2025
Detect cycles in a directed graph using DFS and recursion stack....

Connected Components in Graph

Medium
15 views 22 Dec 2025
Find the number of connected components in an undirected graph....

Topological Sorting of Graph

Medium
13 views 22 Dec 2025
Perform topological sorting on a directed acyclic graph and explain its applications....

Shortest Path in Unweighted Graph

Medium
15 views 22 Dec 2025
Find the shortest path between two vertices in an unweighted graph using BFS....

Dijkstra Algorithm

Medium
13 views 22 Dec 2025
Compute shortest paths from a source vertex in a graph with non-negative weights....

Bellman Ford Algorithm

Medium
14 views 22 Dec 2025
Find shortest paths and detect negative weight cycles using Bellman-Ford algorithm....

Floyd Warshall Algorithm

Medium
13 views 22 Dec 2025
Find shortest paths between all pairs of vertices using dynamic programming....

Minimum Spanning Tree Using Prim

Medium
16 views 22 Dec 2025
Construct a minimum spanning tree using Prim’s algorithm....

Minimum Spanning Tree Using Kruskal

Medium
14 views 22 Dec 2025
Construct a minimum spanning tree using Kruskal’s algorithm....

Union Find Data Structure

Medium
13 views 22 Dec 2025
Explain Union-Find (Disjoint Set Union) and its use in graph problems....

Bipartite Graph Check

Medium
13 views 22 Dec 2025
Check whether a graph is bipartite using BFS or DFS coloring....

Strongly Connected Components

Medium
12 views 22 Dec 2025
Find strongly connected components using Kosaraju’s algorithm....

Graph Coloring Problem

Medium
16 views 22 Dec 2025
Color a graph such that no two adjacent vertices share the same color....

Graph Representation

Medium
15 views 22 Dec 2025
Explain how to represent a graph using adjacency list and adjacency matrix and compare their use cases....

Breadth First Search (BFS)

Medium
15 views 22 Dec 2025
Traverse a graph using Breadth First Search and explain how a queue is used in the process....

Depth First Search (DFS)

Medium
15 views 22 Dec 2025
Traverse a graph using Depth First Search and explain the role of recursion or stack....

Detect Cycle in Undirected Graph

Medium
19 views 22 Dec 2025
Determine whether an undirected graph contains a cycle using DFS or BFS....

Detect Cycle in Directed Graph

Medium
13 views 22 Dec 2025
Detect a cycle in a directed graph using DFS and recursion stack....

Connected Components

Medium
21 views 22 Dec 2025
Find the number of connected components in an undirected graph....

Topological Sort

Medium
16 views 22 Dec 2025
Perform topological sorting of a directed acyclic graph using DFS or Kahn’s algorithm....

Shortest Path in Unweighted Graph

Medium
14 views 22 Dec 2025
Find the shortest path between two vertices in an unweighted graph using BFS....

Dijkstra’s Algorithm

Medium
14 views 22 Dec 2025
Find the shortest path from a source vertex to all other vertices in a weighted graph with non-negative edges....

Bellman-Ford Algorithm

Medium
13 views 22 Dec 2025
Compute shortest paths in a graph that may contain negative edge weights and detect negative cycles....

Floyd Warshall Algorithm

Medium
18 views 22 Dec 2025
Find shortest paths between all pairs of vertices using dynamic programming....

Minimum Spanning Tree (Kruskal)

Medium
16 views 22 Dec 2025
Construct a minimum spanning tree of a graph using Kruskal’s algorithm....

Minimum Spanning Tree (Prim)

Medium
12 views 22 Dec 2025
Construct a minimum spanning tree of a graph using Prim’s algorithm....

Union-Find in Graphs

Medium
12 views 22 Dec 2025
Use Disjoint Set Union (Union-Find) to solve graph connectivity problems....

Bipartite Graph Check

Medium
16 views 22 Dec 2025
Check whether a given graph is bipartite using BFS or DFS coloring....

Shortest Path in DAG

Medium
15 views 22 Dec 2025
Find shortest paths in a Directed Acyclic Graph using topological ordering....

Strongly Connected Components

Medium
16 views 22 Dec 2025
Find strongly connected components in a directed graph using Kosaraju’s algorithm....

Articulation Points

Medium
14 views 22 Dec 2025
Find articulation points in a graph whose removal increases number of connected components....

Bridges in Graph

Medium
15 views 22 Dec 2025
Find all bridges in an undirected graph using DFS....

Graph Coloring

Medium
16 views 22 Dec 2025
Color the vertices of a graph such that no two adjacent vertices share the same color....

Fibonacci Using DP

Medium
16 views 22 Dec 2025
Compute the nth Fibonacci number using dynamic programming and explain how memoization avoids repeated calculations....

Climbing Stairs Problem

Medium
17 views 22 Dec 2025
Given n stairs find the number of distinct ways to climb to the top when you can climb 1 or 2 steps at a time using DP....

0/1 Knapsack Problem

Medium
15 views 22 Dec 2025
Given weights and values determine the maximum value that can be obtained in a knapsack of fixed capacity using DP....

Subset Sum Problem

Medium
19 views 22 Dec 2025
Determine whether there exists a subset of a given set with a sum equal to a given value using dynamic programming....

Longest Common Subsequence

Medium
18 views 22 Dec 2025
Find the length of the longest common subsequence between two strings using DP table construction....

Longest Increasing Subsequence

Medium
18 views 22 Dec 2025
Find the length of the longest increasing subsequence in an array using dynamic programming....

Coin Change (Minimum Coins)

Medium
16 views 22 Dec 2025
Given coin denominations find the minimum number of coins required to make a given amount using DP....

Coin Change (Number of Ways)

Medium
15 views 22 Dec 2025
Find the total number of ways to make a given amount using infinite supply of coins with DP....

Edit Distance

Medium
16 views 22 Dec 2025
Compute the minimum number of operations required to convert one string into another using DP....

Matrix Chain Multiplication

Medium
18 views 22 Dec 2025
Determine the minimum number of scalar multiplications needed to multiply a chain of matrices using DP....

Rod Cutting Problem

Medium
23 views 22 Dec 2025
Given a rod of length n determine the maximum profit by cutting the rod using DP....

House Robber Problem

Medium
19 views 22 Dec 2025
Find the maximum amount of money that can be robbed without robbing adjacent houses using DP....

Maximum Subarray Sum (DP)

Medium
24 views 22 Dec 2025
Find the maximum sum of a contiguous subarray using dynamic programming approach....

Partition Equal Subset Sum

Medium
13 views 22 Dec 2025
Determine whether an array can be partitioned into two subsets with equal sum using DP....

Palindrome Partitioning (Minimum Cuts)

Medium
25 views 22 Dec 2025
Find the minimum number of cuts needed to partition a string into palindromic substrings using DP....

Unique Paths in Grid

Medium
23 views 22 Dec 2025
Find the number of unique paths from top-left to bottom-right of a grid using DP....

Unique Paths with Obstacles

Medium
19 views 22 Dec 2025
Find the number of unique paths in a grid containing obstacles using dynamic programming....

Decode Ways

Medium
16 views 22 Dec 2025
Given a numeric string count the number of ways it can be decoded into letters using DP....

Egg Dropping Problem

Medium
17 views 22 Dec 2025
Find the minimum number of attempts needed to find the critical floor using DP....

Minimum Path Sum

Medium
18 views 22 Dec 2025
Find the minimum path sum from top-left to bottom-right in a grid using DP....

Remove Duplicate Characters

Medium
14 views 22 Dec 2025
Remove duplicate characters from a string while preserving order....

Longest Common Prefix

Medium
13 views 22 Dec 2025
Find the longest common prefix among an array of strings....

Longest Palindromic Substring

Medium
12 views 22 Dec 2025
Find the longest palindromic substring within a given string....

String Rotation Check

Medium
16 views 22 Dec 2025
Check if one string is a rotation of another string....

Count Words in a String

Medium
15 views 22 Dec 2025
Count the number of words in a sentence considering multiple spaces....

Reverse Words in a Sentence

Medium
14 views 22 Dec 2025
Reverse the order of words in a sentence without reversing individual words....

Check Subsequence

Medium
16 views 22 Dec 2025
Check whether one string is a subsequence of another string....

Find All Substrings

Medium
14 views 22 Dec 2025
Generate and print all possible substrings of a given string....

Replace Characters

Medium
11 views 22 Dec 2025
Replace all occurrences of a character with another character in a string....

Check Isomorphic Strings

Medium
17 views 22 Dec 2025
Determine whether two strings are isomorphic with proper character mapping....

Longest Repeating Character Replacement

Medium
15 views 22 Dec 2025
Find the length of the longest substring containing the same character after replacements....

Validate Parentheses String

Medium
15 views 22 Dec 2025
Check whether a string containing parentheses is valid....

String Compression

Medium
15 views 22 Dec 2025
Compress a string by counting consecutive repeated characters....

Pattern Matching (Naive)

Medium
16 views 22 Dec 2025
Implement naive pattern matching to find occurrences of a pattern in a text....

Reverse a String

Medium
13 views 22 Dec 2025
Reverse a given string without using any built-in reverse function and explain the logic clearly....

Check Palindrome String

Medium
14 views 22 Dec 2025
Check whether a given string is a palindrome by comparing characters from both ends....

Count Vowels and Consonants

Medium
16 views 22 Dec 2025
Count the number of vowels and consonants present in a string....

Find Duplicate Characters

Medium
16 views 22 Dec 2025
Identify duplicate characters in a string using an efficient approach....

Check Anagram Strings

Medium
15 views 22 Dec 2025
Check whether two strings are anagrams of each other and explain the reasoning....

First Non-Repeating Character

Medium
12 views 22 Dec 2025
Find the first non-repeating character in a string....

Find Maximum and Minimum Element

Medium
13 views 22 Dec 2025
Given an array of integers, find both the maximum and minimum elements using an efficient approach and explain why it reduces comparisons....

Reverse an Array In-Place

Medium
17 views 22 Dec 2025
Reverse the elements of an array without using extra space and explain how swapping works step by step....

Rotate Array by K Positions

Medium
17 views 22 Dec 2025
Rotate an array to the right by K positions and describe different possible approaches....

Find Second Largest Element

Medium
13 views 22 Dec 2025
Find the second largest element in an array without sorting the array....

Check if Array is Sorted

Medium
14 views 22 Dec 2025
Check whether a given array is sorted in ascending order and explain the logic used....

Move All Zeros to End

Medium
10 views 22 Dec 2025
Move all zero elements to the end of the array while maintaining the order of non-zero elements....

Find Duplicate Elements

Medium
14 views 22 Dec 2025
Identify all duplicate elements present in an array using efficient techniques....

Remove Duplicates from Sorted Array

Medium
19 views 22 Dec 2025
Remove duplicate elements from a sorted array in-place and return the new length....

Find Missing Number

Medium
12 views 22 Dec 2025
Find the missing number in an array containing numbers from 1 to N....

Maximum Subarray Sum

Medium
15 views 22 Dec 2025
Find the maximum sum of a contiguous subarray and explain Kadane’s Algorithm....

Count Frequency of Elements

Medium
16 views 22 Dec 2025
Count the frequency of each element in an array and store the result efficiently....

Merge Two Sorted Arrays

Medium
13 views 22 Dec 2025
Merge two sorted arrays into a single sorted array without using extra space if possible....

Find Majority Element

Medium
14 views 22 Dec 2025
Find the element that appears more than n/2 times in an array using optimized approach....

Rearrange Array Alternately

Medium
15 views 22 Dec 2025
Rearrange array elements in max-min alternate order....

Check Subarray with Given Sum

Medium
11 views 22 Dec 2025
Check whether there exists a subarray with a given sum and explain the sliding window technique....

Find Intersection of Two Arrays

Medium
13 views 22 Dec 2025
Find the intersection of two arrays and return common elements....

Find Union of Two Arrays

Medium
16 views 22 Dec 2025
Find the union of two arrays and remove duplicates....

Stock Buy and Sell

Medium
16 views 22 Dec 2025
Given stock prices, find the maximum profit by buying and selling once....

Trapping Rain Water

Medium
14 views 22 Dec 2025
Calculate how much rain water can be trapped between bars of different heights....

Chocolate Distribution Problem

Medium
18 views 22 Dec 2025
Distribute chocolates such that the difference between max and min is minimum....

Binary Search

Medium
13 views 22 Dec 2025
Search for a target element in a sorted array by repeatedly dividing the search space into two halves until the element is found or the search space becomes empty....

Merge Sort

Medium
17 views 22 Dec 2025
Sort an array by dividing it into smaller subarrays sorting each subarray and then merging them back into a sorted array....

Quick Sort

Medium
14 views 22 Dec 2025
Sort an array by selecting a pivot element partitioning the array around the pivot and recursively sorting the subarrays....

Find Maximum and Minimum

Medium
16 views 22 Dec 2025
Find the maximum and minimum elements in an array using the minimum number of comparisons by dividing the array into smaller parts....

Strassen’s Matrix Multiplication

Medium
16 views 22 Dec 2025
Multiply two matrices efficiently using Strassen’s divide and conquer algorithm to reduce time complexity....

Closest Pair of Points

Medium
19 views 22 Dec 2025
Given points on a 2D plane find the closest pair of points using divide and conquer approach....

Karatsuba Algorithm

Medium
12 views 22 Dec 2025
Multiply two large integers efficiently using the Karatsuba divide and conquer technique....

Median of Two Sorted Arrays

Medium
15 views 22 Dec 2025
Find the median of two sorted arrays in logarithmic time using divide and conquer....

Tromino Tiling Problem

Medium
15 views 22 Dec 2025
Tile a 2^n x 2^n board with one missing square using L-shaped trominoes and divide and conquer....

Find Majority Element

Medium
14 views 22 Dec 2025
Find the element that appears more than n/2 times in an array using divide and conquer....

Power Set via Divide and Conquer

Medium
15 views 22 Dec 2025
Generate the power set of a given set by dividing the set and combining results....

Kth Smallest Element

Medium
15 views 22 Dec 2025
Find the kth smallest element in an array using a divide and conquer based selection algorithm....

Square Root Using Binary Search

Medium
16 views 22 Dec 2025
Compute the square root of a number using binary search divide and conquer approach....

Matrix Chain Multiplication (Conceptual)

Medium
13 views 22 Dec 2025
Explain how matrix chain multiplication problem can be solved using divide and conquer and optimization ideas....

Skyline Problem

Medium
15 views 22 Dec 2025
Given buildings in a city find the skyline formed using divide and conquer technique....

Check if a Number is Even or Odd

Medium
50 views 22 Dec 2025
Determine whether a given integer is even or odd using bitwise operators instead of arithmetic operators....

Find the Only Non-Repeating Element

Medium
25 views 22 Dec 2025
Given an array where every element appears twice except one find that unique element using XOR....

Count Set Bits

Medium
21 views 22 Dec 2025
Count the number of set bits (1s) in the binary representation of a number....

Check Power of Two

Medium
18 views 22 Dec 2025
Check whether a given number is a power of two using bitwise operations....

Swap Two Numbers Without Temp

Medium
19 views 22 Dec 2025
Swap two numbers without using a temporary variable using XOR operation....

Find Rightmost Set Bit

Medium
22 views 22 Dec 2025
Find the position of the rightmost set bit in a number....

Turn Off Rightmost Set Bit

Medium
21 views 22 Dec 2025
Turn off the rightmost set bit of a given number....

Set the ith Bit

Medium
19 views 22 Dec 2025
Set the ith bit of a given number using bitwise operators....

Clear the ith Bit

Medium
21 views 22 Dec 2025
Clear the ith bit of a given number....

Toggle the ith Bit

Medium
23 views 22 Dec 2025
Toggle the ith bit of a number using XOR....

Check ith Bit is Set

Medium
21 views 22 Dec 2025
Check whether the ith bit of a number is set or not....

Multiply by Two Using Bits

Medium
16 views 22 Dec 2025
Multiply a number by two using left shift operation....

Divide by Two Using Bits

Medium
17 views 22 Dec 2025
Divide a number by two using right shift operation....

Find Missing Number

Medium
23 views 22 Dec 2025
Find the missing number in an array containing numbers from 1 to N using XOR....

Single Number II

Medium
16 views 22 Dec 2025
Find the element that appears once when others appear three times....

Add Two Numbers Without Plus

Medium
15 views 22 Dec 2025
Add two integers without using the + operator....

Reverse Bits

Medium
17 views 22 Dec 2025
Reverse the bits of a given 32-bit unsigned integer....

Check Opposite Signs

Medium
15 views 22 Dec 2025
Check whether two integers have opposite signs using bit manipulation....

Bitwise AND of Range

Medium
18 views 22 Dec 2025
Compute bitwise AND of all numbers in a given range [L, R]....

Gray Code Generation

Medium
20 views 22 Dec 2025
Generate the sequence of Gray codes for n bits using bit manipulation....

Solve N-Queens Problem

Medium
20 views 22 Dec 2025
Given an N x N chessboard place N queens such that no two queens attack each other using backtracking....

Generate All Permutations of a String

Medium
19 views 22 Dec 2025
Generate all possible permutations of a string using backtracking and recursion....

Generate All Subsets (Power Set)

Medium
20 views 22 Dec 2025
Generate all subsets of a given array using backtracking....

Combination Sum

Medium
15 views 22 Dec 2025
Find all combinations that sum to a target where numbers can be reused....

Combination Sum II

Medium
19 views 22 Dec 2025
Find unique combinations that sum to target where each number is used once....

Generate Parentheses

Medium
16 views 22 Dec 2025
Generate all valid combinations of balanced parentheses....

Word Search in Grid

Medium
17 views 22 Dec 2025
Check if a word exists in a grid using backtracking....

Sudoku Solver

Medium
19 views 22 Dec 2025
Solve a partially filled Sudoku board using backtracking....

Rat in a Maze

Medium
21 views 22 Dec 2025
Find all paths from source to destination in a maze using backtracking....

Knight’s Tour

Medium
18 views 22 Dec 2025
Visit all squares of a chessboard using a knight exactly once....

Palindrome Partitioning

Medium
20 views 22 Dec 2025
Partition a string into all palindromic substrings....

Restore IP Addresses

Medium
20 views 22 Dec 2025
Generate all valid IP addresses from a digit string....

Letter Combinations of Phone Number

Medium
18 views 22 Dec 2025
Generate all letter combinations from phone digits....

Graph Coloring Problem

Medium
21 views 22 Dec 2025
Color a graph using M colors without adjacent conflicts....

Hamiltonian Path

Medium
17 views 22 Dec 2025
Determine if a Hamiltonian path exists in a graph....

Partition into K Equal Sum Subsets

Medium
15 views 22 Dec 2025
Check if array can be partitioned into K equal sum subsets....

Binary Strings Without Consecutive Ones

Medium
22 views 22 Dec 2025
Generate binary strings of length N without consecutive ones....

Remove Invalid Parentheses

Medium
17 views 22 Dec 2025
Remove minimum invalid parentheses to make string valid....

Unique Paths with Obstacles

Medium
16 views 22 Dec 2025
Find all paths in grid with obstacles using backtracking....

Word Break Using Dictionary

Medium
15 views 22 Dec 2025
Break a string into dictionary words using backtracking....

Design and Implement an LRU Cache

Medium
21 views 22 Dec 2025
Design an LRU (Least Recently Used) Cache that supports get(key) and put(key, value) operations in constant time O(1). The cache should automatically remove the least recently accessed item when the c...

Design a Stack with Constant-Time Minimum Retrieval

Medium
28 views 22 Dec 2025
Design a stack data structure that supports standard stack operations such as push, pop, and top, along with an additional operation getMin() that returns the minimum element present in the stack at a...

Implement Trie for Prefix-Based Search

Medium
19 views 22 Dec 2025
Implement a Trie (Prefix Tree) data structure that supports insertion of words and searching for complete words as well as prefixes. Explain how the Trie improves search efficiency compared to a norma...

Union-Find with Path Compression

Medium
23 views 22 Dec 2025
Implement the Disjoint Set Union (Union-Find) data structure with path compression and union by rank. Explain how these optimizations reduce the time complexity of find and union operations in large d...

Segment Tree for Range Sum Queries

Medium
14 views 22 Dec 2025
Design and implement a Segment Tree to efficiently answer range sum queries on an array. The structure should also support point updates. Explain how segment trees divide the problem space and why the...

Fenwick Tree (Binary Indexed Tree)

Medium
18 views 22 Dec 2025
Implement a Fenwick Tree (Binary Indexed Tree) to handle prefix sum queries and updates efficiently. Compare its performance and memory usage with a Segment Tree....

Design a Sliding Window Maximum Structure

Medium
20 views 22 Dec 2025
Given an array and a window size k, design a data structure that efficiently finds the maximum element in every sliding window. Explain how a deque helps achieve linear time complexity....

Implement a Priority Queue using Heap

Medium
15 views 22 Dec 2025
Implement a Priority Queue using a binary heap. Explain how insertion and deletion operations maintain the heap property and why heaps are suitable for priority-based processing....

Design a Data Structure for Median of a Stream

Medium
18 views 22 Dec 2025
Design a data structure that continuously receives numbers from a data stream and returns the median at any time. Explain how two heaps can be used to balance the elements and compute the median effic...

LRU Cache vs LFU Cache

Medium
22 views 22 Dec 2025
Explain the difference between LRU (Least Recently Used) and LFU (Least Frequently Used) caching strategies. Discuss scenarios where one strategy is preferred over the other and the data structures re...

Range Minimum Query with Range Updates

Easy
22 views 22 Dec 2025
You are given an array of integers and need to handle two types of queries efficiently:

Range Update: Add a value to all elements in a given range [l, r]

Range Query: Find the minimum value in a...