My solutions to coding interview problems on LeetCode, AlgoExpert, GFG, Educative, and Other Coding Sites. I will be adding my solutions to this repository every day whenever I do solve them :)
Difficulty Levels solved :
π’ Easy: 70
π‘ Medium: 60
π΄ Hard:2
β«οΈ Very Hard: 0
π Good to review
Total - 132
Adding solutions to all problems I have completed today
Focus for today: Arrays, Strings
- π’ Remove Duplicates from Sorted Array Notes: Use Hash Map!
- π’ Rotate Array Notes: Recursion or (i+k)%n Index!
- π’ Reverse String Notes: Recursion!
- π’ Palindrome Check Notes: 2 Pointer's (Best)!
Sliding Window Technique Pattern
Focus for today: STL/ Linked Lists
- π‘ Remove Nth Node From End of List Notes: π use fast and slow pointer's
- π’ Delete Node in a Linked List Notes: free(temp) doesn't works!
- π‘ Linked List Construction Notes: Nothing π
Sliding Window Technique Pattern Notes: Mostly use HashMaps or HashSets!
- π‘ Longest Substring with K Distinct Characters
- π’ Maximum Sum Subarray of Size K
- π’ Smallest Subarray with a given sum
Focus for today: Linked Lists/Contest
- π‘ Minimum Operations to Make Array Equal Notes: take average
- π’ Three Consecutive Odds Notes: cakeWalk!
- π’ Reverse Linked List
Focus for today: Linked Lists
- π’ Linked List Cycle Notes: unordered set or 2 pointers
- π’ Palindrome Linked List Notes: divide into 2 equal parts and use 2 pointers
- π΄ Merge Linked Lists Notes: π 3 pointers
Focus for today: Trees
- π‘ Binary Tree Inorder Traversal Notes:π use stack
- π‘ Validate Binary Search Tree Notes: inorder has to be in sorted
- π‘ Kth Smallest Element in a BST Notes: think of inorder
- π’ Find Mode in Binary Search Tree Notes: think of preorder
- π‘ BST Construction Notes: π basics
Focus for today: Trees
- π‘ Binary Tree Level Order Traversal Notes:π use queue
- π’ Convert Sorted Array to Binary Search Tree Notes: πbinary search
- π’ Maximum Depth of Binary Tree Notes: Either BFS/DFS
- π’ Find Closest Value in BST Notes: helper function
Focus for today: Trees
- π’ Invert Binary Tree Notes: π queue/recursion
- π’ Thousand Seperator Notes: Brute-Force
- π’ Valid Parentheses Notes: use stack
Focus for today: Contest
- π’ Most Visited Sector in a Circular Track Notes: circular => f = f%n
- π‘ Maximum Number of Coins You Can Get Notes: reverse and give you first
Focus for today: Trees
- π‘ Check Completeness of a Binary Tree Notes: πuse flag
- π‘ Sum Root to Leaf Numbers Notes: recursion
- π’ Symmetric Tree Notes: recursion(best)
Focus for today: Trees
- π‘ Path Sum II Notes: careful of callstack
- π’ Range Sum of BST Notes: Do any DFS - Cakewalk
- π’ Binary Tree Path Sum
- π‘ All Paths for a Sum
- π‘ Sum of Path Numbers
Focus for today: Trees
- π‘ Path With Given Sequence
- π‘ Count Paths for a Sum Notes: πCareful of count in recursion
Focus for today: Graphs
- π‘ Number of Connected Components in an Undirected Graph Notes: dfs pattern
- π‘ Number of Islands Notes: dfs in all 4 dirs
- π’ Depth First Search Notes: helper recursive function
Focus for today: Algorithms
- π‘ Maximum Length of Subarray With Positive Product Notes: ππcareful of zeroes
- π’ Merge Two Binary Trees Notes: Update the Node, after every step for backtracking!
- π‘ Kadane's Algorithm Notes: used for finding maxSubArray
- π’ Nth Fibonacci Notes: Iterative method best among all!
Focus for today: Everything
- π’ Majority Element Notes: Moore's Voting Algorithm
- π’ Valid Anagram Notes: take care of t.c and s.c
Focus for today: Everything
- π’ Excel Sheet Column Number Notes: use map
- π’ First Unique Character in a String
Focus for today: Everything
- π’ Repeated Substring Pattern Notes: make duplicate and ignore 1st and last
Focus for today: Recursions, Contest
- π‘ Permutations Notes: π use backtracking
- π‘ Subsets Notes: backtracking
- π’ Matrix Diagonal Sum
- π‘ Subsets II Notes: backtraking
Focus for today: Backtracking
- π‘ Combinations
- π‘ Combination Sum
- π‘ Combination Sum II
Focus for today: Analysing Patterns
Sub Sets Pattern Notes: Follows BFS in every Approach
- π‘ String Permutation
- π‘ Playing With Permutations
- π‘ Combination of Subsets 2
- π’ Combination of Subset
Focus for today: September Challenge
- π‘ Compare Version Numbers Notes: use istringstream and stoi stl
- π‘ Word Pattern Notes: use unordered maps
Focus for today: Strings
Focus for today: Strings
- π‘ Group Anagrams _Bucket Everything in hashmap and take care of TC and SC.
- π΄ Longest Substring Without Duplication
Focus for today: Arrays
- π‘ Three Sum Notes: Take Care of Duplicates
- π‘ Smallest Difference Notes: Two Pointers
Focus for today: Arrays
- π‘ Move Element To End Notes: Two Pointers
- π‘ Monotonic Array Notes: One Pass π₯
- π’ Monotonicity
Focus for today: Contest, Miscellaneous
- π‘ XOR Queries of a Subarray Notes: xorSum vector and manupalate
- π’ Decrypt String from Alphabet to Integer Mapping Notes: general
Focus for today: Interview Questions
- π’ Intersection of Two Arrays II Notes: set-intersection stl
- π’ Power of 3 Notes: log2(n) / log2(3)
- π’ Prime Numbers Notes: Sieve of eratosthenes
- π‘ Spiral Traversal Notes: Make Sure of 4 variables and dir
- π‘ Longest Peak Notes: Binary Search
- π’ Cyclic Rotate
- π’ Find the maximum and minimum element in an array
- π’ Find the "Kth" max and min element of an array
- π’ Move all the negative elements to one side of the array
- π‘ Find duplicate in an array of N+1 Integers
- π‘ Find Largest sum contiguous Subarray
- π‘ Longest Consecutive Subsequence
- π‘ Merge Intervals
- π‘ Find maximum product subarray
- π‘ Smallest subarray with sum greater than a given value
Inspired by DeepakTalwar/interview-prep-cpp