Skip to content

shrinathjoshi/Leetcode-30-day-challenge

Repository files navigation

Leetcode-30-day-challenge

May Challenge

Day Problem Statement Solution Difficulty Data Structure Used Algorithm used Time Complexity Space Complexity Ideal Time to Solve
1 First Bad Version First Bad Version Easy Array Binary Search O(logn) O(1) 15-30 min
2 Jewels and Stones Jewels and Stones Easy HashMap frequency counting O(n) O(n) 15-30 min
3 Ransom Note Ransome Note Easy Array Char Frequency Counting O(n) O(1) 15-30 min
4 Number Complement Number Complement Easy NA Bit Manipulation O(log(v) , v= value of number O(1) 15-30 min
5 First Unique Character in a String First Unique Character in a String Easy HashMap Frequency Counting O(n) O(n) 10 min
6 Majority Element Majority Element Easy NA Boyer Moore Algorithm O(n) O(1) 30-45 min
7 Cousins in Binary Tree Cousins in Binary Tree Easy NA NA O(n) O(log(n)) Resursive stack 15-30 min
8 Check If It Is a Straight Line Check If It Is a Straight Line Easy NA Slope of a line O(n) O(1) 15-20 min
9 Valid Perfect Square Valid Perfect Square Easy NA Binary Search O(logn) O(1) 15-30 min
10 Find the Town Judge Find the Town Judge Easy NA NA O(n) O(n) 15-30min
11 Flood Fill Flood Fill Easy Graph Graph Traversal BFS/DFS O(n) O(n) 30 min
12 Single Element in a Sorted Array Single Element in a Sorted Array Easy NA Two pointer Algo O(logn) O(1) 15-30 min
13 Remove K Digits Remove K Digits Easy NA Greedy Algorithm O(kn) O(1) 30-45 min
14 Implement Trie (Prefix Tree) Implement Trie (Prefix Tree) Medium Trie NA O(m) O(m) 30-45 min
15 Maximum Sum Circular Subarray Maximum Sum Circular Subarray Medium NA Kadane's Algorithm O(n) O(1) 45 min
16 Odd Even Linked List Odd Even Linked List Easy Linked List NA O(n) O(1) 15-30 min
17 Find All Anagrams in a String Find All Anagrams in a String Medium NA Sliding Window O(n) O(1) 45 min
18 Permutation in String Permutation in String Easy NA Sliding Window O(n) O(1) 30min
19 Online Stock Span Online Stock Span Easy Stack NA O(n) O(n) 30min
20 Kth Smallest Element in a BST Kth Smallest Element in a BST Medium NA Modified Inorder Traversal O(n) O(n) 30min
21 Count Square Submatrices with All Ones Count Square Submatrices with All Ones Medium NA Dynamic Programming O(n*m) O(n*m) 45min
22 Sort Characters By Frequency Sort Characters By Frequency Easy HashMap, Priority Queue NA O(nlogn) O(n) 30min
23 Interval List Intersections Interval List Intersections Easy NA NA O(n) O(n) 30min
24 Construct Binary Search Tree from Preorder Traversal Construct Binary Search Tree from Preorder Traversal Medium NA NA O(nlog) O(1) 45min
25 Uncrossed Lines Uncrossed Lines Medium NA Dynamic Programming O(nm) n and m are size of Array A & B O(nm) n and m are size of Array A & B 45 min
26 Contiguous Array Contiguous Array Medium HashMap NA O(n) O(n) 45 min
27* Possible Bipartition Possible Bipartition Medium NA Graph Colouring O(V+E) O(V) 1 hr
28 Counting Bits Counting Bits Easy NA Bit Manipulation O(n) O(n) 30min
29 Course Schedule Course Schedule Medium NA Kahn's Algorithm O(V+E) O(V) 45 min
30 K Closest Points to Origin K Closest Points to Origin Easy Priority Queue NA O((n-k)logk) , n is the number of points O(n) , n is the number of points 30min
31 Edit Distance Edit Distance Hard NA String Edit Distance O(m*n) where m and n are length of two string O(m*n) where m and n are length of two string 45 min

June Challenge

Day Problem Statement Solution Difficulty Data Structure Used Algorithm used Time Complexity Space Complexity
1 Invert Binary Tree Invert Binary Tree Easy Binary Tree NA O(n) O(n)
2 Delete A Node in a LinkedList Delete A Node in a LinkedList Easy LinkedList NA O(1) O(1)
3* Two City Scheduling Two City Scheduling Easy Priority Queue NA O(nlogn) O(n)
4 Reverse String Reverse String Easy NA Two Pointer O(n) O(1)

July Challenge

Day Problem Statement Solution Difficulty Data Structure Used Algorithm used Time Complexity Space Complexity Additional Reading
4 Hamming Distance Hamming Distance Easy NA Bit Manipulation O(1) O(1) https://www.techiedelight.com/brian-kernighans-algorithm-count-set-bits-integer/
5 Plus One Plus One Easy NA NA O(N) O(1) Back To Back SWE

August Challenge

Day Problem Statement Solution Difficulty Data Structure Used Algorithm used Time Complexity Space Complexity Additional Reading
1 Hamming Distance Hamming Distance Easy NA Bit Manipulation O(1) O(1) https://www.techiedelight.com/brian-kernighans-algorithm-count-set-bits-integer/
2 Plus One Plus One Easy NA NA O(N) O(1) Back To Back SWE
3 Valid Palindrome Plus One Easy NA NA O(N) O(1)
4 Plus One Plus One Easy NA NA O(N) O(1) Back To Back SWE

September Challenge

October Challenge

Day Problem Statement Solution Difficulty Data Structure Used Algorithm used Time Complexity Space Complexity Additional Reading
15 189. Rotate Array Java Easy String O(N) O(1)
17 187. Repeated DNA Sequences Java Easy String O(N) O(N)

November Challenge

Day Problem Statement Solution Difficulty Data Structure Used Algorithm used Time Complexity Space Complexity Additional Reading
6 1283. Find the Smallest Divisor Given a Threshold Java Medium Binary Search O(NlogM) O(1) Discuss DiscussBinary Search 101
12 47. Permutations II Java Medium Backtracing Discuss

Daily Coding Challenge

Day Problem Statement Solution Difficulty Data Structure Used Algorithm used Time Complexity Space Complexity
1 442. Find All Duplicates in an Array Java Medium NA NA O(n) O(1)
2 863. All Nodes Distance K in Binary Tree
3 938. Range Sum of BST
4 863. All Nodes Distance K in Binary Tree
5 863. All Nodes Distance K in Binary Tree
6 863. All Nodes Distance K in Binary Tree

If this repository was helpful to you then do star this repository, Also please feel free to contribute to this repo. Contibutions are always welcomed

You can connect me on LinkedIn