DSA CRACKER Save

This is an attempt to solve 450 questions carefully curated by Love Babbar.

Project README

DSA-CRACKER

LOC Stars Badge Forks Badge GitHub contributors

If you appreciate my work, please 🌟 this repository. It motivates me. :rocket: :rocket:

DSA CRACKER sheet : link

:red_circle: :red_circle: IMPORTANT : If you forked this repo and want to be updated with the changes made to this repo refer How do I update a GitHub forked repository?

:arrow_forward: Update Corner

  • Added Clone A Graph problem in the Graphs topic.

:gift: You Can Contribute.

Make a pull request :

  • If you think you have the better optimal solution.
  • If you have the solution to the unsolved problem marked with "red-cross".

Hello, folks!

This is an attempt to solve 450 questions carefully curated by our very own Love Babbar.

Topics

Array

# Title Solution Time Space Difficulty Note
1 Reverse an Array :heavy_check_mark: - - - -
2 Find the maximum and minimum element in an array :heavy_check_mark: - - - -
3 Find the "Kth" max and min element of an array :heavy_check_mark: - - - -
4 Given an array which consists of only 0, 1 and 2. Sort the array without using any sorting algo :heavy_check_mark: - - - -
5 Move all the negative elements to one side of the array :heavy_check_mark: - - -
6 Find the Union and Intersection of the two sorted arrays. :heavy_check_mark: - - - -
7 Write a program to cyclically rotate an array by one. :heavy_check_mark: - - - -
8 find Largest sum contiguous Subarray V. IMP :heavy_check_mark: - - - -
9 Minimise the maximum difference between heights V.IMP :heavy_check_mark: - - - Revisit
10 Minimum no. of Jumps to reach end of an array :heavy_check_mark: - - - Revisit
11 find duplicate in an array of N+1 Integers :heavy_check_mark: - - - -
12 Merge 2 sorted arrays without using Extra space. :heavy_check_mark: - - - Revisit
13 Kadane's Algo [V.V.V.V.V IMP] :heavy_check_mark: - - - -
14 Merge Intervals :heavy_check_mark: - - - -
15 Next Permutation :heavy_check_mark: - - - -
16 Count Inversion :heavy_check_mark: - - - -
17 Best time to buy and Sell stock :heavy_check_mark: - - - Pending variations
18 find all pairs on integer array whose sum is equal to given number :heavy_check_mark: - - - -
19 find common elements In 3 sorted arrays :heavy_check_mark: - - - -
20 Rearrange the array in alternating positive and negative items with O(1) extra space :heavy_check_mark: - - - -
21 Find if there is any subarray with sum equal to 0 :heavy_check_mark: - - - -
22 Find factorial of a large number :heavy_check_mark: - - -
23 find maximum product subarray :heavy_check_mark: - - - -
24 Find longest coinsecutive subsequence :heavy_check_mark: - - - -
25 Given an array of size n and a number k, fin all elements that appear more than " n/k " times. :heavy_check_mark: - - - -
26 Maximum profit by buying and selling a share atmost twice :heavy_check_mark: - - - -
27 Find whether an array is a subset of another array :heavy_check_mark: - - -
28 Find the triplet that sum to a given value :heavy_check_mark: - - - -
29 Trapping Rain water problem :heavy_check_mark: - - - Revisit
30 Chocolate Distribution problem :heavy_check_mark: - - - -
31 Smallest Subarray with sum greater than a given value :heavy_check_mark: - - - -
32 Three way partitioning of an array around a given value :heavy_check_mark: - - -
33 Minimum swaps required bring elements less equal K together :heavy_check_mark: - - - -
34 Minimum no. of operations required to make an array palindrome :heavy_check_mark: - - - -
35 Median of 2 sorted arrays of equal size :heavy_check_mark: - - - Revisit
36 Median of 2 sorted arrays of different size :heavy_check_mark: - - - -


Matrix

# Title Solution Time Space Difficulty Note
1 Spiral traversal on a Matrix :heavy_check_mark:
2 Search an element in a matriix :heavy_check_mark:
3 Find median in a row wise sorted matrix :heavy_check_mark:
4 Find row with maximum no. of 1's :heavy_check_mark:
5 Print elements in sorted order using row-column wise sorted matrix :heavy_check_mark:


StackQueue

# Title Solution Time Space Difficulty Note
1 Implement Stack from Scratch :heavy_check_mark: - - -
2 https://www.tutorialspoint.com/javaexamples/data_stack.htm :heavy_check_mark: - - - -
3 Implement 2 stack in an array :heavy_check_mark: - - - -
4 Find the middle element of a stack :heavy_check_mark: O(n) O(n) - -
5 Implement "N" stacks in an Array :heavy_check_mark: - - -
6 Check the expression has valid or Balanced parenthesis or not. :heavy_check_mark: - - - -
7 Reverse a String using Stack :heavy_check_mark: - - - -
8 Design a Stack that supports getMin() in O(1) time and O(1) extra space. :heavy_check_mark: - - - -
9 Find the next Greater element :heavy_check_mark: - - - -
10 The celebrity Problem :heavy_check_mark: - - - -
11 Arithmetic Expression evaluation :heavy_check_mark: - - - -
12 Evaluation of Postfix expression :heavy_check_mark: - - - -
13 Implement a method to insert an element at its bottom without using any other data structure. :heavy_check_mark: - - - -
14 Reverse a stack using recursion :heavy_check_mark: - - - -
15 Sort a Stack using recursion :heavy_check_mark: - - - -
16 Merge Overlapping Intervals :heavy_check_mark: O(n*logn) O(1) - -
17 Largest rectangular Area in Histogram :heavy_check_mark: O(n) O(n) - -
18 Length of the Longest Valid Substring :heavy_check_mark: O(n) O(1) - -
19 Expression contains redundant bracket or not :heavy_check_mark: O(n) O(n) - -
20 Implement Stack using Queue :heavy_check_mark: O(n) O(n) - -


Backtracking

# Title Solution Time Space Difficulty Note
1 Rat In A Maze :heavy_check_mark: - - -
2 N Queens Problem :heavy_check_mark: - - -
3 M coloring Problem :heavy_check_mark: O(n^m) O(n) -
5 Sudoku Solver :heavy_check_mark: - - -


Graphs

# Title Solution Time Space Difficulty Note
6 Flood fill Algorithm :heavy_check_mark: O(n*m) O(n*m) -
7 Minimum Step By Knight :heavy_check_mark: - - -
9 Clone A Graph :heavy_check_mark: - - -
13 Implement Topological Sorting :heavy_check_mark: - - -
22 Implement Floyd Warshall Algorithm :heavy_check_mark: - - -
25 Snake and Ladder Problem :heavy_check_mark: O(n) O(n) -
27 Strongly Connected Components (Kosaraju's Algo) :heavy_check_mark: - - -
32 Cheapest Flights within k stops :heavy_check_mark: Quadratic Quadratic Medium
37 Maximum Product Subarray :heavy_check_mark: - - - -
358 searching element in Graph using DFS :heavy_check_mark: O(V+E) O(V) Medium


Binary Tree

# Title Solution Time Space Difficulty Note
1 Right View of Binary Tree :heavy_check_mark: o(n) O(n) Medium
2 Height of Binary Tree :heavy_check_mark: O(N) O(N) Medium
3 Diameter of Binary Tree :heavy_check_mark: O(N) O(log(N)) Easy
4 Check for Balanced Tree :heavy_check_mark: O(N) O(log(N)) Easy
5 Binary Tree Postorder Traversal :heavy_check_mark: O(n) O(n) Easy
6 Bottom View of Binary Tree :heavy_check_mark: O(n) O(n) Medium


Arrays In Javascript Implementation

# Title Solution Time Space Difficulty Note
1 Reverse an Array :heavy_check_mark: O(N) O(1) Easy
2 Find MAximum and Minimum in Array :heavy_check_mark: O(N) O(1)) Easy
3 Dutch National Flag [ Sort 0's , 1's and 2's without sorting] :heavy_check_mark: O(N) O(N)) Easy

LinkedList

# Title Solution Time Space Difficulty Note
1 Write a program to Detect loop in a linked list. :heavy_check_mark: - - Easy -
2 Write a Program to check whether the Singly Linked list is a palindrome or not. :heavy_check_mark: O(n) O(n) Easy -
3 Write a Program to Remove duplicate element from sorted Linked List. :heavy_check_mark: O(n) O(1) Easy -


You can find me on LinkedIn to stay updated and follow along with my journey.

Open Source Agenda is not affiliated with "DSA CRACKER" Project. README Source: tarunsinghdev/DSA-CRACKER