50 DSA Problems To Secure A 7-15LPA Job
50 DSA Problems To Secure A 7-15LPA Job
2. Array Problems
3. String Problems
7. Graph Problems
12. Conclusion
1. Introduction
This document outlines 50 carefully selected Data Structures and Algorithms (DSA)
problems that are essential for cracking interviews at top companies offering salaries
in the range of 7-15 LPA. These problems cover various topics, ensuring a
comprehensive preparation.
2. Array Problems
1. Find the Largest Sum Contiguous Subarray (Kadane’s Algorithm)
o Example: Input: [-2, 1, -3, 4, -1, 2, 1, -5, 4] Output: 6 (Subarray: [4,
-1, 2, 1])
3. Merge Intervals
o Example: Input: [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,10],[15,18]]
4. Edit Distance
o Example: Input: Words "horse", "ros" Output: 3
2. *Merge Sort*
- *Example*: Input: [5, 2, 9, 1, 5, 6] Output: [1, 2, 5, 5, 6, 9]
3. *Quick Sort*
- *Example*: Input: [10, 7, 8, 9, 1, 5] Output: [1, 5, 7, 8, 9, 10]
8. *Heap Sort*
- *Example*: Input: [12, 11, 13, 5, 6, 7] Output: [5, 6, 7, 11, 12, 13]
9. *Counting Sort*
- *Example*: Input: [4, 2, 2, 8, 3, 3, 1] Output: [1, 2, 2, 3, 3, 4, 8]
1. *N-Queens Problem*
- *Example*: Input: n = 4 Output: All arrangements of 4 queens on a 4x4 chessboard.
2. *Sudoku Solver*
- *Example*: Input: Partially filled 9x9 board Output: Completed board.
3. *Word Search*
- *Example*: Input: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCCED"
Output: true
4. *Permutations of a String*
- *Example*: Input: "ABC" Output: ["ABC", "ACB", "BAC", "BCA", "CAB", "CBA"]
5. *Subsets*
- *Example*: Input: nums = [1,2,3] Output: [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]
6. *Combination Sum*
- *Example*: Input: candidates = [2,3,6,7], target = 7 Output: [[7],[2,2,3]]
7. *Rat in a Maze*
- *Example*: Input: A maze grid Output: All possible paths from start to finish.
8. *Palindrome Partitioning*
- *Example*: Input: "aab" Output: [["a","a","b"],["aa","b"]]
3. *Huffman Encoding*
- *Example*: Input: Characters and frequencies Output: Huffman tree and codes.
Conclusion
This compilation of problems spans all major DSA topics, providing a solid foundation for cracking
interviews at top tech companies. Each problem is carefully chosen to help you understand key concepts
and apply them effectively. With consistent practice and a deep understanding of these problems, you'll
be well-equipped to tackle any coding challenge.