DSA C++ Problem Statement
1. Introduction to Data Structures
1. Define and differentiate between various data structures.
2. Implement a basic example of an abstract data type (ADT).
3. Explain and implement stack operations using arrays.
4. Explain and implement queue operations using arrays.
5. Compare and contrast linear and non-linear data structures with examples.
6. Design a simple application that uses a data structure effectively.
7. Implement a basic stack and queue using linked lists.
8. Write code to demonstrate the use of hash tables.
9. Implement a priority queue using a heap.
10. Explain the significance of data structures in algorithm efficiency.
11. Develop a class for a basic list ADT.
12. Create a function that returns the size of different data structures.
13. Write a program to convert an ADT to a concrete data structure.
14. Implement a dynamic array with resizing.
15. Implement a simple dictionary using hash maps.
16. Design a simple application to showcase dynamic data structures.
17. Write code to test different data structures in terms of performance.
18. Implement basic operations for a graph ADT.
19. Explain the role of data structures in optimizing algorithm performance.
20. Write a program that uses a stack to reverse a string.
21. Design an ADT for a tree and implement basic operations.
22. Create a basic implementation of a graph using an adjacency matrix.
23. Design a data structure to keep track of the frequency of characters.
24. Implement a data structure that supports fast lookups and updates.
25. Explain how to choose the appropriate data structure for a given problem.
26. Design a data structure to manage a list of unique elements.
27. Create a program to simulate a simple memory management system.
28. Implement a priority queue using an unordered list.
29. Compare the efficiency of different data structures in terms of time complexity.
30. Write a program to demonstrate the use of a linked list in real-world applications.
2. Arrays
1. Implement array operations: insertion, deletion, and traversal.
2. Write a program to reverse an array.
3. Find the maximum and minimum elements in an array.
4. Implement a function to rotate an array.
5. Write code to find the kth largest element in an array.
6. Remove duplicates from a sorted array.
7. Find the intersection of two arrays.
8. Merge two sorted arrays.
9. Implement a function to find the subarray with the maximum sum.
10. Check if an array contains duplicate elements.
11. Implement a function to find the majority element in an array.
12. Write a program to sort an array using bubble sort.
13. Implement a function to perform binary search on a sorted array.
14. Write code to find the missing number in an array of n-1 elements.
15. Find the common elements between three sorted arrays.
16. Implement a function to move all zeroes to the end of an array.
17. Write a program to find the median of two sorted arrays.
18. Implement an algorithm to find pairs with a given sum in an array.
19. Write code to check if an array is a permutation of another array.
20. Implement a function to find the longest consecutive sequence in an array.
21. Write a program to rearrange positive and negative numbers in an array.
22. Implement an algorithm to find the duplicate number in an array.
23. Write code to find the intersection of two unsorted arrays.
24. Implement a function to find the longest subarray with equal number of 0s and 1s.
25. Write a program to find the minimum number of jumps required to reach the end of an
array.
26. Implement a function to find the first non-repeating element in an array.
27. Write code to find the longest subarray with distinct elements.
28. Implement a function to rotate an array by d positions.
29. Write a program to find the maximum product subarray.
30. Implement an algorithm to sort an array using selection sort.
3. Linked Lists
1. Implement a singly linked list with basic operations (insert, delete, traverse).
2. Write code to reverse a singly linked list.
3. Implement a doubly linked list with basic operations.
4. Write a function to detect a loop in a linked list.
5. Implement a circular linked list and perform basic operations.
6. Write a program to find the middle element of a linked list.
7. Merge two sorted linked lists into a single sorted list.
8. Write code to remove duplicates from an unsorted linked list.
9. Implement a function to find the nth node from the end of a linked list.
10. Write a program to split a linked list into two halves.
11. Implement a function to rotate a linked list by k positions.
12. Write code to find the intersection point of two linked lists.
13. Implement a function to reverse every k nodes in a linked list.
14. Write a program to detect and remove a loop in a linked list.
15. Implement a function to find the length of a linked list.
16. Write code to check if a linked list is a palindrome.
17. Implement a function to add two numbers represented by linked lists.
18. Write a program to sort a linked list using merge sort.
19. Implement a function to find the starting point of the loop in a linked list.
20. Write code to flatten a multi-level linked list.
21. Implement a function to delete a given node in a linked list.
22. Write a program to merge k sorted linked lists.
23. Implement a function to find the loop length in a linked list.
24. Write code to remove all occurrences of a given value from a linked list.
25. Implement a function to swap nodes in a linked list.
26. Write a program to find the intersection node of two linked lists.
27. Implement a function to reverse a portion of a linked list.
28. Write code to find the union and intersection of two linked lists.
29. Implement a function to create a linked list from an array.
30. Write a program to perform deep copy of a linked list with random pointers.
4. Stacks
1. Implement a stack using arrays.
2. Implement a stack using linked lists.
3. Write a function to check for balanced parentheses using a stack.
4. Implement stack operations: push, pop, peek, and isEmpty.
5. Write a program to evaluate a postfix expression.
6. Implement a stack that supports minimum element retrieval in constant time.
7. Write a function to sort a stack using recursion.
8. Implement a function to reverse a stack using recursion.
9. Write a program to convert an infix expression to postfix.
10. Implement a stack to manage function calls (call stack simulation).
11. Write a function to sort a stack without using additional storage.
12. Implement a stack with push, pop, top, and getMin operations.
13. Write code to check if a given expression has balanced parentheses.
14. Implement a function to find the next greater element for each element in an array using a
stack.
15. Write a program to remove adjacent duplicates from a string using a stack.
16. Implement a function to find the maximum area of a rectangle in a histogram.
17. Write a program to evaluate a prefix expression.
18. Implement a function to check if a stack is a valid sequence of function calls.
19. Write a program to implement a stack that supports getMax operation in constant time.
20. Implement a function to match parentheses in an expression.
21. Write a program to sort a stack using another stack.
22. Implement a function to perform infix to prefix conversion.
23. Write code to find the longest valid parentheses substring using a stack.
24. Implement a stack with support for push, pop, and retrieving the median.
25. Write a program to check if a stack can be popped in a given order.
26. Implement a function to perform a stack-based depth-first search (DFS).
27. Write code to implement a stack-based undo functionality.
28. Implement a function to simulate a stack using two queues.
29. Write a program to find the maximum rectangle area in a 2D matrix using stacks.
30. Implement a function to evaluate arithmetic expressions with variables using a stack.
5. Queues
1. Implement a queue using arrays.
2. Implement a queue using linked lists.
3. Write a function to implement a circular queue.
4. Implement a double-ended queue (deque) using arrays.
5. Write a program to implement a priority queue using a heap.
6. Implement a function to perform enqueue and dequeue operations.
7. Write code to simulate a queue using two stacks.
8. Implement a queue with support for retrieving the maximum element.
9. Write a function to rotate a queue.
10. Implement a queue that supports getMin operation in constant time.
11. Write a program to implement a queue with fixed size and dynamic resizing.
12. Implement a function to check if a queue is empty or full.
13. Write code to reverse the elements of a queue.
14. Implement a queue using a linked list with support for all basic operations.
15. Write a function to implement a priority queue using a sorted list.
16. Implement a queue with enqueue, dequeue, and retrieve median operations.
17. Write a program to simulate a real-world queue scenario (e.g., customer service line).
18. Implement a function to find the maximum element in a queue.
19. Write code to implement a queue with the support for the front and rear operations.
20. Implement a function to merge two queues into a single queue.
21. Write a program to rotate a queue by k positions.
22. Implement a function to remove duplicate elements from a queue.
23. Write code to simulate a circular buffer using a queue.
24. Implement a function to find the longest consecutive sequence in a queue.
25. Write a program to simulate a queue-based scheduling algorithm.
26. Implement a function to reverse the order of elements in a queue.
27. Write code to implement a queue with priority levels.
28. Implement a function to check if a queue is a palindrome.
29. Write a program to find the sum of elements in a queue.
30. Implement a function to find the difference between the maximum and minimum
elements in a queue.
6. Recursion
1. Write a recursive function to calculate factorial of a number.
2. Implement a recursive function to find the nth Fibonacci number.
3. Write code to solve the Tower of Hanoi problem.
4. Implement a function to calculate the sum of elements in an array using recursion.
5. Write a recursive function to reverse a string.
6. Implement a recursive function to find the greatest common divisor (GCD).
7. Write code to solve the n-Queens problem using recursion.
8. Implement a function to compute the power of a number using recursion.
9. Write a recursive function to generate all permutations of a string.
10. Implement a function to solve the subset sum problem using recursion.
11. Write code to find all possible subsets of a set using recursion.
12. Implement a recursive function to solve the knapsack problem.
13. Write a function to generate all combinations of a string using recursion.
14. Implement a recursive function to perform binary search on a sorted array.
15. Write code to solve the coin change problem using recursion.
16. Implement a function to compute the sum of digits of a number using recursion.
17. Write a recursive function to find the longest common subsequence (LCS) of two strings.
18. Implement a function to solve the maze problem using recursion.
19. Write code to perform merge sort using recursion.
20. Implement a recursive function to solve the 8-puzzle problem.
21. Write a function to find the minimum number of coins needed to make a given amount
using recursion.
22. Implement a recursive function to solve the Josephus problem.
23. Write code to generate the power set of a set using recursion.
24. Implement a function to calculate the number of ways to climb stairs with n steps using
recursion.
25. Write a recursive function to solve the Rat in a Maze problem.
26. Implement a function to find the longest increasing subsequence (LIS) using recursion.
27. Write code to solve the longest common prefix problem using recursion.
28. Implement a function to find all possible combinations of a given set of numbers that sum
up to a target value using recursion.
29. Write a recursive function to count the number of ways to arrange a set of items.
30. Implement a function to solve the partition problem using recursion.
7. Trees
1. Implement a binary tree with basic operations (insert, delete, traverse).
2. Write a function to perform inorder traversal of a binary tree.
3. Implement a function to find the height of a binary tree.
4. Write code to check if a binary tree is balanced.
5. Implement a function to check if a binary tree is a binary search tree (BST).
6. Write a program to perform level-order traversal (BFS) of a binary tree.
7. Implement a function to find the lowest common ancestor (LCA) of two nodes in a BST.
8. Write code to convert a binary tree to a doubly linked list.
9. Implement a function to find the diameter of a binary tree.
10. Write a program to find the maximum depth of a binary tree.
11. Implement a function to perform preorder traversal of a binary tree.
12. Write code to perform postorder traversal of a binary tree.
13. Implement a function to insert a node in a BST.
14. Write a program to delete a node from a BST.
15. Implement a function to find the kth smallest element in a BST.
16. Write code to find all ancestors of a given node in a binary tree.
17. Implement a function to find the longest path between two leaves in a binary tree.
18. Write a program to check if two binary trees are identical.
19. Implement a function to find the maximum width of a binary tree.
20. Write code to construct a binary tree from its inorder and preorder traversals.
21. Implement a function to find the common ancestors of two nodes in a binary tree.
22. Write a program to print all leaf nodes of a binary tree.
23. Implement a function to perform a level-order traversal using a queue.
24. Write code to serialize and deserialize a binary tree.
25. Implement a function to find the depth of the deepest leaf node.
26. Write a program to balance a binary search tree.
27. Implement a function to find the sum of all nodes at a given level.
28. Write code to find the maximum path sum in a binary tree.
29. Implement a function to print all nodes at distance k from a given node.
30. Write a program to build a binary search tree from a sorted array.
8. Graphs
1. Implement a graph using an adjacency matrix.
2. Implement a graph using an adjacency list.
3. Write a function to perform breadth-first search (BFS) on a graph.
4. Implement a function to perform depth-first search (DFS) on a graph.
5. Write code to find the shortest path in a graph using Dijkstra’s algorithm.
6. Implement the Bellman-Ford algorithm to find shortest paths in a graph.
7. Write a program to find the minimum spanning tree using Kruskal’s algorithm.
8. Implement Prim’s algorithm to find the minimum spanning tree of a graph.
9. Write a function to detect cycles in a directed graph.
10. Implement a function to detect cycles in an undirected graph.
11. Write code to find all strongly connected components in a directed graph.
12. Implement a function to find all connected components in an undirected graph.
13. Write a program to find the shortest path in an unweighted graph using BFS.
14. Implement a function to find the topological sort of a directed acyclic graph (DAG).
15. Write code to find the strongly connected components (SCCs) of a directed graph.
16. Implement a function to detect a cycle in a directed graph.
17. Write a program to find the number of connected components in an undirected graph.
18. Implement a function to find the longest path in a DAG.
19. Write code to find the shortest path between all pairs of nodes (Floyd-Warshall
algorithm).
20. Implement a function to perform a depth-first search on a graph with a given start node.
21. Write a program to find the articulation points in a graph.
22. Implement a function to find the bridges (cut-edges) in a graph.
23. Write code to find the shortest path using the A* algorithm.
24. Implement a function to perform a topological sort on a graph.
25. Write a program to check if a graph is bipartite.
26. Implement a function to find the minimum number of colors required to color a graph.
27. Write code to find the shortest path in a grid using BFS.
28. Implement a function to find the minimum spanning tree using Borůvka’s algorithm.
29. Write a program to check if a graph is a tree.
30. Implement a function to perform a graph traversal and print all nodes at each level.
9. Hashing
1. Implement a hash table with separate chaining.
2. Implement a hash table with open addressing.
3. Write a function to compute a hash value for a given key.
4. Implement a function to resolve collisions using linear probing.
5. Write a program to handle hash table resizing and rehashing.
6. Implement a function to handle hash collisions using quadratic probing.
7. Write code to find the most frequent element in an array using hashing.
8. Implement a function to check for duplicate elements in an array using a hash table.
9. Write a program to check if two strings are anagrams using hashing.
10. Implement a function to count the frequency of elements in an array using a hash table.
11. Write code to find all pairs with a given sum using hashing.
12. Implement a hash table with double hashing.
13. Write a function to find the intersection of two arrays using hashing.
14. Implement a function to find all unique elements in an array using hashing.
15. Write code to handle hash collisions using chaining.
16. Implement a function to create a hash map from key-value pairs.
17. Write a program to find the number of distinct elements in an array using hashing.
18. Implement a function to find the first non-repeating character in a string using hashing.
19. Write code to detect if a sequence of operations can be represented by a valid hash table.
20. Implement a function to find all substrings with unique characters using hashing.
21. Write a program to count the number of unique substrings in a string using hashing.
22. Implement a hash table with support for dynamic resizing.
23. Write code to find pairs of elements that add up to a specific target value using hashing.
24. Implement a function to remove duplicates from a list using a hash table.
25. Write a program to handle hash table load factor and capacity management.
26. Implement a function to find the first duplicate character in a string using hashing.
27. Write code to implement a hash table with custom hash functions.
28. Implement a function to find the longest consecutive sequence in an array using hashing.
29. Write a program to find common elements between multiple arrays using hashing.
30. Implement a hash table with support for deleting entries.
10. Sorting Algorithms
1. Implement bubble sort.
2. Implement selection sort.
3. Write a function to perform insertion sort.
4. Implement merge sort.
5. Write a function to perform quick sort.
6. Implement heap sort.
7. Write a function to perform radix sort.
8. Implement counting sort.
9. Write code to perform bucket sort.
10. Implement a function to sort an array using shell sort.
11. Write a program to sort an array using comb sort.
12. Implement a function to perform tim sort.
13. Write code to find the kth smallest/largest element using quick select.
14. Implement a function to sort a nearly sorted array.
15. Write a program to sort an array using bitwise operations.
16. Implement a function to perform gnome sort.
17. Write code to sort an array of strings.
18. Implement a function to sort a linked list using merge sort.
19. Write a program to sort an array of objects based on a key.
20. Implement a function to perform cycle sort.
21. Write code to sort an array of floating-point numbers.
22. Implement a function to sort an array of integers using odd-even sort.
23. Write a program to sort an array using pancake sort.
24. Implement a function to sort an array using bead sort.
25. Write code to perform a parallel sort.
26. Implement a function to sort an array using a comparison-based algorithm.
27. Write a program to implement a stable sorting algorithm.
28. Implement a function to sort an array using a non-comparison-based algorithm.
29. Write code to implement a sorting algorithm with custom comparison functions.
30. Implement a function to sort a list of tuples based on multiple keys.
11. Searching Algorithms
1. Implement linear search.
2. Write a function to perform binary search on a sorted array.
3. Implement interpolation search.
4. Write code to perform exponential search.
5. Implement a function to search in a rotated sorted array.
6. Write a program to find the first occurrence of an element in a sorted array using binary
search.
7. Implement a function to find the last occurrence of an element in a sorted array using
binary search.
8. Write code to find the count of occurrences of an element in a sorted array.
9. Implement a function to perform a search on an infinite sorted array.
10. Write a program to find the smallest element in a rotated sorted array.
11. Implement a function to find the largest element in a rotated sorted array.
12. Write code to find the closest pair in a sorted array using binary search.
13. Implement a function to search for a range of elements in a sorted array.
14. Write a program to find the first missing positive integer in an unsorted array.
15. Implement a function to find the element that appears only once in a sorted array.
16. Write code to find the peak element in an array using binary search.
17. Implement a function to search for a pattern in a text using the Knuth-Morris-Pratt
(KMP) algorithm.
18. Write a program to find the longest prefix suffix (LPS) array for KMP algorithm.
19. Implement a function to search for a pattern in a text using Rabin-Karp algorithm.
20. Write code to perform a ternary search on a sorted array.
21. Implement a function to find the majority element in an array using Boyer-Moore voting
algorithm.
22. Write a program to search for a key in a binary search tree.
23. Implement a function to find the shortest substring containing all characters of a pattern.
24. Write code to search for a given key in a 2D matrix.
25. Implement a function to search for a pattern in a text using the Boyer-Moore algorithm.
26. Write a program to find the smallest window containing all characters of a pattern.
27. Implement a function to find the longest common prefix of an array of strings.
28. Write code to find the shortest path in an unweighted graph using BFS.
29. Implement a function to search for an element in a rotated sorted array with duplicates.
30. Write a program to find the first duplicate element in an unsorted array.
12. String Algorithms
1. Implement a function to perform naive string matching.
2. Write code to implement the Knuth-M Morris-Pratt (KMP) algorithm for string matching.
3. Implement a function for Rabin-Karp algorithm for pattern matching.
4. Write code to find the longest common prefix of two strings.
5. Implement a function to find the longest common substring of two strings.
6. Write a program to find all anagrams of a string in a given text.
7. Implement a function to check if a string is a palindrome.
8. Write code to perform string reversal.
9. Implement a function to count the frequency of characters in a string.
10. Write a program to perform substring search in a text.
11. Implement a function to find the longest repeating substring.
12. Write code to remove all duplicate characters from a string.
13. Implement a function to check if two strings are anagrams.
14. Write a program to perform string concatenation.
15. Implement a function to find the shortest substring containing all characters of a pattern.
16. Write code to replace all occurrences of a substring in a string.
17. Implement a function to find the longest palindromic substring.
18. Write a program to perform string tokenization.
19. Implement a function to find all possible substrings of a string.
20. Write code to find the longest palindromic subsequence.
21. Implement a function to perform string compression.
22. Write a program to count the number of distinct substrings in a string.
23. Implement a function to check if a string contains all unique characters.
24. Write code to find the longest common subsequence of two strings.
25. Implement a function to find the minimum number of insertions required to make a string
a palindrome.
26. Write a program to perform pattern matching using the Boyer-Moore algorithm.
27. Implement a function to find the shortest palindrome that can be formed by adding
characters to a string.
28. Write code to find the longest substring without repeating characters.
29. Implement a function to perform case-insensitive string comparison.
30. Write a program to perform string interleaving.
13. Advanced Data Structures
1. Implement a segment tree for range sum queries.
2. Write a function to build a segment tree from an array.
3. Implement a Fenwick Tree (Binary Indexed Tree) for prefix sum queries.
4. Write code to update an element in a Fenwick Tree.
5. Implement a disjoint-set (union-find) data structure with path compression and union by
rank.
6. Write a function to perform union and find operations in a disjoint-set data structure.
7. Implement a suffix tree for substring search.
8. Write code to build a suffix array from a string.
9. Implement a B-tree for balanced search operations.
10. Write a function to insert and delete keys in a B+ Tree.
11. Implement a priority queue using a binary heap.
12. Write code to perform operations on a priority queue.
13. Implement a trie for efficient prefix matching.
14. Write a function to insert and search words in a trie.
15. Implement a segment tree for range minimum queries.
16. Write code to perform range update operations in a segment tree.
17. Implement a suffix array for string matching.
18. Write a function to perform range queries on a segment tree.
19. Implement a disjoint-set with union by rank and path compression.
20. Write code to perform range queries using a Fenwick Tree.
21. Implement a segment tree for range maximum queries.
22. Write a function to perform batch updates on a segment tree.
23. Implement a trie for efficient pattern matching.
24. Write code to find the longest common substring using a suffix tree.
25. Implement a priority queue with custom comparison functions.
26. Write a function to find the shortest path in a weighted graph using a priority queue.
27. Implement a B-tree with support for insertion and deletion operations.
28. Write code to perform prefix sum queries using a Fenwick Tree.
29. Implement a suffix tree for longest common prefix queries.
30. Write a function to perform range queries using a segment tree.
14. Dynamic Programming
1. Solve the Fibonacci sequence using memoization.
2. Implement the Longest Common Subsequence (LCS) problem.
3. Solve the 0/1 Knapsack problem.
4. Write a program for the Coin Change problem.
5. Implement the Longest Increasing Subsequence (LIS) problem.
6. Solve the Edit Distance problem.
7. Implement the Minimum Path Sum problem in a grid.
8. Solve the House Robber problem.
9. Implement the Palindromic Substrings problem.
10. Write a program for the Matrix Chain Multiplication problem.
11. Implement the Partition Equal Subset Sum problem.
12. Solve the Rod Cutting problem.
13. Implement the Wildcard Matching problem.
14. Write a program for the Word Break problem.
15. Implement the Jump Game problem.
16. Solve the Minimum Cost Climbing Stairs problem.
17. Implement the Unique Paths problem.
18. Solve the Maximum Subarray problem.
19. Implement the Longest Palindromic Subsequence problem.
20. Solve the Tiling problem (covering a 2xN board with 2x1 tiles).
21. Implement the Subset Sum problem.
22. Solve the Decode Ways problem (number of ways to decode a message).
23. Implement the Egg Dropping problem.
24. Solve the Box Stacking problem.
25. Implement the Boolean Parenthesization problem.
26. Solve the Maximum Product Subarray problem.
27. Implement the Longest Bitonic Subsequence problem.
28. Solve the Catalan Number problem.
29. Implement the Minimum Number of Jumps to Reach the End problem.
30. Solve the Minimum Insertions to Form a Palindrome problem.
15. Greedy Algorithms
1. Implement the Activity Selection problem.
2. Solve the Fractional Knapsack problem.
3. Implement the Huffman Coding algorithm.
4. Solve the Minimum Number of Platforms problem.
5. Implement the Job Sequencing problem.
6. Solve the Kruskal’s Minimum Spanning Tree (MST) problem.
7. Implement the Prim’s Minimum Spanning Tree (MST) problem.
8. Solve the Dijkstra’s Shortest Path problem.
9. Implement the Greedy approach for the Coin Change problem.
10. Solve the Egyptian Fraction problem.
11. Implement the Gas Station problem.
12. Solve the Interval Scheduling Maximization problem.
13. Implement the Greedy algorithm for the Set Cover problem.
14. Solve the Task Scheduling problem.
15. Implement the Shortest Superstring problem.
16. Solve the Greedy algorithm for the Activity Selection with Multiple Resources problem.
17. Implement the Minimum Cost to Connect Ropes problem.
18. Solve the Optimal Merge Pattern problem.
19. Implement the Largest Number problem from a set of numbers.
20. Solve the Greedy Florist problem.
21. Implement the Minimize the Maximum Difference Between Heights problem.
22. Solve the Maximum Number of Toys problem.
23. Implement the Rearrange Characters in a String problem.
24. Solve the Smallest Subset with Sum Greater than All Other Elements problem.
25. Implement the Greedy algorithm for the N meetings in one room problem.
26. Solve the Minimize the Sum of Product problem.
27. Implement the Maximize the Sum of Array after K Negations problem.
28. Solve the Minimum Number of Coins problem.
29. Implement the Choose and Swap problem.
30. Solve the Greedy algorithm for the Load Balancing problem.
16. Backtracking
1. Solve the N-Queens problem.
2. Implement the Sudoku Solver.
3. Solve the Rat in a Maze problem.
4. Implement the Subset Sum problem.
5. Solve the Permutation of Strings problem.
6. Implement the Combination Sum problem.
7. Solve the Hamiltonian Path problem.
8. Implement the Word Search problem in a grid.
9. Solve the Palindrome Partitioning problem.
10. Implement the Knight’s Tour problem.
11. Solve the M-Coloring problem.
12. Implement the Crossword Puzzle problem.
13. Solve the Tug of War problem.
14. Implement the Boggle Solver.
15. Solve the Coin Change problem with a limited supply of coins.
16. Implement the Generate All Parentheses problem.
17. Solve the Remove Invalid Parentheses problem.
18. Implement the Letter Combinations of a Phone Number problem.
19. Solve the Restore IP Addresses problem.
20. Implement the Find All Possible Words From a Phone Number problem.
21. Solve the Minimum Number of Coins problem using backtracking.
22. Implement the Generate Palindromic Decompositions problem.
23. Solve the N Knights problem.
24. Implement the Binary Strings with No Consecutive 1s problem.
25. Solve the Josephus problem using backtracking.
26. Implement the Find All Subsets problem.
27. Solve the Unique Paths III problem.
28. Implement the Print All Permutations problem.
29. Solve the Generate All Subsets of Size K problem.
30. Implement the Find All Distinct Subsets problem.
17. Bit Manipulation
1. Write a program to check if a number is even or odd using bitwise operators.
2. Implement a function to find the only non-repeating element in an array.
3. Solve the Single Number problem using XOR.
4. Implement a function to swap two numbers without using a temporary variable.
5. Solve the Count Set Bits problem.
6. Implement a function to determine if a number is a power of two.
7. Solve the Find Missing Number problem in an array.
8. Implement a function to toggle the ith bit of a number.
9. Solve the Find Two Non-Repeating Elements in an Array problem.
10. Implement a function to count the number of 1s in a binary number.
11. Solve the Reverse Bits problem.
12. Implement a function to find the position of the rightmost set bit.
13. Solve the Check if Binary Representation of a Number is a Palindrome problem.
14. Implement a function to multiply a number by 7 without using multiplication.
15. Solve the Count Number of Flips to Convert A to B problem.
16. Implement a function to check if two numbers have opposite signs.
17. Solve the Divide a Number by 2 using Bit Manipulation problem.
18. Implement a function to find the XOR of all elements in an array.
19. Solve the Find the Element that Appears Once in a Sorted Array problem.
20. Implement a function to convert a binary number to Gray code.
21. Solve the Check if a Number is a Power of Four problem.
22. Implement a function to find the smallest power of two greater than or equal to a given
number.
23. Solve the Find the Position of the Rightmost Different Bit problem.
24. Implement a function to add two numbers without using the + operator.
25. Solve the Convert a Given Integer to Binary String problem.
26. Implement a function to clear the rightmost set bit of a number.
27. Solve the Find the Next Higher Number with the Same Number of Set Bits problem.
28. Implement a function to find the position of the leftmost set bit.
29. Solve the Find the Missing Number in an Arithmetic Sequence problem using XOR.
30. Implement a function to perform bitwise AND of two numbers without using the AND
operator.