Skip to content

My Codes and Solutions to coding interview problems on LeetCode, AlgoExpert, Educative and other interview preparation websites

License

Notifications You must be signed in to change notification settings

abhisheknaiidu/dsa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Interview Preparation

Stars Badge Forks Badge GitHub contributors License Badge

Arrays

  • Sieve
  • Catalan Numbers
  • Sliding Window Technique
  • Recursion and Backtracking
  • Binary Search (TopCoder)
  • BacktoBackSWE Playlist
  • Tortoise and Hare Pointer

Trees

  • Flatten Tree
  • Height of Tree
  • Iterative Traversals
  • Lowest Common Ancestor
  • Level Order Traversal
  • Diameter of a Binary Tree
  • Recursive Traversals
  • Diagonal Traversal
  • Vertical Traversal
  • Serialize and Deserialize Trees
  • Other BackToBackSWE Ones

Graphs

  • BFS Problems
  • Graph coloring/Bipartition
  • DFS Problems
  • Topological Sort
  • Union Find
  • Find Shortest Path (Dijkstra's/Bellman Ford
  • BackToBackSWE Playlist
  • LeetCode Graphs Patterns

Searching and Sorting

  • Bubble Sort
  • Insertion Sort
  • Quick Sort
  • Merge Sort
  • Inversion Count
  • Count Numbers Larger and Smaller than Self
  • Radix Sort
  • Count Sort
  • Heap Sort
  • Binary Search
  • BackToBackSWE Playlist

Linked Lists

  • Insert
  • Delete Nth Node
  • Reverse
  • Merge Two Sorted Linked List
  • Fast Pointer, Slow Pointer technique
  • Doubly Linked List
  • BackToBackSWE Playlist

Hashing

  • Various Types of Hashing

Bit Manipulation

  • Basics
  • BitMasking
  • Powerset and Find tha nums

One Month Challenge :')

Difficulty Levels solved :

🟒 Easy: 70
🟑 Medium: 60
πŸ”΄ Hard:2
⚫️ Very Hard: 0
🌟 Good to review

Total - 132

Day 0

Adding solutions to all problems I have completed today

Focus for today: Arrays, Strings

LeetCode

  1. 🟒 Remove Duplicates from Sorted Array Notes: Use Hash Map!
  2. 🟒 Rotate Array Notes: Recursion or (i+k)%n Index!
  3. 🟒 Reverse String Notes: Recursion!

AlgoExpert

  1. 🟒 Palindrome Check Notes: 2 Pointer's (Best)!

Educative

Sliding Window Technique Pattern

  1. 🟒 Average of all contiguous subarrays of size β€˜K’

Day 1

Focus for today: STL/ Linked Lists

LeetCode

  1. 🟑 Remove Nth Node From End of List Notes: 🌟 use fast and slow pointer's
  2. 🟒 Delete Node in a Linked List Notes: free(temp) doesn't works!

AlgoExpert

  1. 🟑 Linked List Construction Notes: Nothing πŸ˜†

Educative

Sliding Window Technique Pattern Notes: Mostly use HashMaps or HashSets!

  1. 🟑 Longest Substring with K Distinct Characters
  2. 🟒 Maximum Sum Subarray of Size K
  3. 🟒 Smallest Subarray with a given sum

Day 2

Focus for today: Linked Lists/Contest

LeetCode

  1. 🟑 Minimum Operations to Make Array Equal Notes: take average
  2. 🟒 Three Consecutive Odds Notes: cakeWalk!
  3. 🟒 Reverse Linked List

Day 3

Focus for today: Linked Lists

LeetCode

  1. 🟒 Linked List Cycle Notes: unordered set or 2 pointers
  2. 🟒 Palindrome Linked List Notes: divide into 2 equal parts and use 2 pointers

AlgoExpert

  1. πŸ”΄ Merge Linked Lists Notes: 🌟 3 pointers

Day 4

Focus for today: Trees

LeetCode

  1. 🟑 Binary Tree Inorder Traversal Notes:🌟 use stack
  2. 🟑 Validate Binary Search Tree Notes: inorder has to be in sorted
  3. 🟑 Kth Smallest Element in a BST Notes: think of inorder
  4. 🟒 Find Mode in Binary Search Tree Notes: think of preorder

AlgoExpert

  1. 🟑 BST Construction Notes: 🌟 basics

Day 5

Focus for today: Trees

LeetCode

  1. 🟑 Binary Tree Level Order Traversal Notes:🌟 use queue
  2. 🟒 Convert Sorted Array to Binary Search Tree Notes: 🌟binary search
  3. 🟒 Maximum Depth of Binary Tree Notes: Either BFS/DFS

AlgoExpert

  1. 🟒 Find Closest Value in BST Notes: helper function

Day 6

Focus for today: Trees

LeetCode

  1. 🟒 Invert Binary Tree Notes: 🌟 queue/recursion
  2. 🟒 Thousand Seperator Notes: Brute-Force
  3. 🟒 Valid Parentheses Notes: use stack

Day 7

Focus for today: Contest

LeetCode

  1. 🟒 Most Visited Sector in a Circular Track Notes: circular => f = f%n
  2. 🟑 Maximum Number of Coins You Can Get Notes: reverse and give you first

Day 8

Focus for today: Trees

LeetCode

  1. 🟑 Check Completeness of a Binary Tree Notes: 🌟use flag
  2. 🟑 Sum Root to Leaf Numbers Notes: recursion
  3. 🟒 Symmetric Tree Notes: recursion(best)

Day 9

Focus for today: Trees

LeetCode

  1. 🟑 Path Sum II Notes: careful of callstack
  2. 🟒 Range Sum of BST Notes: Do any DFS - Cakewalk

Educative

Depth First Search Pattern

  1. 🟒 Binary Tree Path Sum
  2. 🟑 All Paths for a Sum
  3. 🟑 Sum of Path Numbers

Day 10

Focus for today: Trees

Educative

Depth First Search Pattern

  1. 🟑 Path With Given Sequence
  2. 🟑 Count Paths for a Sum Notes: 🌟Careful of count in recursion

Day 11

Focus for today: Graphs

LeetCode

  1. 🟑 Number of Connected Components in an Undirected Graph Notes: dfs pattern
  2. 🟑 Number of Islands Notes: dfs in all 4 dirs

AlgoExpert

  1. 🟒 Depth First Search Notes: helper recursive function

Day 12

Focus for today: Algorithms

LeetCode

  1. 🟑 Maximum Length of Subarray With Positive Product Notes: 🌟🌟careful of zeroes
  2. 🟒 Merge Two Binary Trees Notes: Update the Node, after every step for backtracking!

AlgoExpert

  1. 🟑 Kadane's Algorithm Notes: used for finding maxSubArray
  2. 🟒 Nth Fibonacci Notes: Iterative method best among all!

Day 13

Focus for today: Everything

LeetCode

  1. 🟒 Majority Element Notes: Moore's Voting Algorithm
  2. 🟒 Valid Anagram Notes: take care of t.c and s.c

Day 14

Focus for today: Everything

LeetCode

  1. 🟒 Excel Sheet Column Number Notes: use map
  2. 🟒 First Unique Character in a String

Day 15

Focus for today: Everything

LeetCode

  1. 🟒 Repeated Substring Pattern Notes: make duplicate and ignore 1st and last

Day 16

Focus for today: Recursions, Contest

LeetCode

  1. 🟑 Permutations Notes: 🌟 use backtracking
  2. 🟑 Subsets Notes: backtracking
  3. 🟒 Matrix Diagonal Sum
  4. 🟑 Subsets II Notes: backtraking

Day 17

Focus for today: Backtracking

LeetCode

  1. 🟑 Combinations
  2. 🟑 Combination Sum
  3. 🟑 Combination Sum II

Day 18

Focus for today: Analysing Patterns

Educative

Sub Sets Pattern Notes: Follows BFS in every Approach

  1. 🟑 String Permutation
  2. 🟑 Playing With Permutations
  3. 🟑 Combination of Subsets 2
  4. 🟒 Combination of Subset

Day 19

Focus for today: September Challenge

LeetCode

  1. 🟑 Compare Version Numbers Notes: use istringstream and stoi stl
  2. 🟑 Word Pattern Notes: use unordered maps

Day 20

Focus for today: Strings

AlgoExpert

  1. 🟒 Caesar Ciphor Encryptor
  2. 🟑 Longest Palindromic Substring

Day 21

Focus for today: Strings

AlgoExpert

  1. 🟑 Group Anagrams _Bucket Everything in hashmap and take care of TC and SC.
  2. πŸ”΄ Longest Substring Without Duplication

Day 22

Focus for today: Arrays

AlgoExpert

  1. 🟑 Three Sum Notes: Take Care of Duplicates
  2. 🟑 Smallest Difference Notes: Two Pointers

Day 23

Focus for today: Arrays

AlgoExpert

  1. 🟑 Move Element To End Notes: Two Pointers
  2. 🟑 Monotonic Array Notes: One Pass πŸ”₯

LeetCode

  1. 🟒 Monotonicity

Day 24

Focus for today: Contest, Miscellaneous

LeetCode

  1. 🟑 XOR Queries of a Subarray Notes: xorSum vector and manupalate
  2. 🟒 Decrypt String from Alphabet to Integer Mapping Notes: general

Day 25

Focus for today: Interview Questions

LeetCode

  1. 🟒 Intersection of Two Arrays II Notes: set-intersection stl
  2. 🟒 Power of 3 Notes: log2(n) / log2(3)
  3. 🟒 Prime Numbers Notes: Sieve of eratosthenes

Day 26

  1. 🟑 Spiral Traversal Notes: Make Sure of 4 variables and dir
  2. 🟑 Longest Peak Notes: Binary Search

Day 27

  1. 🟒 Cyclic Rotate
  2. 🟒 Find the maximum and minimum element in an array
  3. 🟒 Find the "Kth" max and min element of an array
  4. 🟒 Move all the negative elements to one side of the array

Day 28

  1. 🟑 Find duplicate in an array of N+1 Integers
  2. 🟑 Find Largest sum contiguous Subarray
  3. 🟑 Longest Consecutive Subsequence
  4. 🟑 Merge Intervals
  5. 🟑 Find maximum product subarray
  6. 🟑 Smallest subarray with sum greater than a given value

Inspired by DeepakTalwar/interview-prep-cpp

Releases

No releases published

Packages

No packages published

Languages