Skip to content

Writing intuitions and approaches for Leetcode problems divided based on difficulty

Notifications You must be signed in to change notification settings

adityajamwal02/Leetcode-Community-Solutions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 

Repository files navigation

Leetcode-Community-Solutions

Intuitions, approaches and code for Leetcode Problems which have been explained by me with solutions. Divided based on difficulty to easily access different questions.


Note:

If you find this repository helpful, consider giving it a star!

If you find my solutions helpful, consider giving them upvotes!


EASY

ID Title Solution Link
20 Valid Parentheses https://shorturl.at/eiruT
21 Merge Two Sorted Lists https://shorturl.at/agvy0
35 Search Insert Position https://shorturl.at/efqvy
69 Sqrt(x) https://shorturl.at/oyLTW
94 Binary Tree Inorder Traversal https://shorturl.at/IQ089
100 Same Tree https://shorturl.at/zALSZ
101 Symmetric Tree https://shorturl.at/ahxAP
104 Maximum Depth of Binary Tree https://shorturl.at/acmsZ
112 Path Sum https://shorturl.at/rDFMR
160 Intersection of Two Linked Lists https://shorturl.at/izX46
202 Happy Number https://shorturl.at/degtY
206 Reverse Linked List https://shorturl.at/lqt78
226 Invert Binary Tree https://shorturl.at/hrDJ2
232 Implement Queue using Stacks https://shorturl.at/fmKN3
326 Power of Three https://shorturl.at/vwxN1
401 Binary Watch https://shorturl.at/abAN6
404 Sum of Left Leaves https://shorturl.at/dpES6
509 Fibonacci Number https://shorturl.at/copy2
543 Diameter of Binary Tree https://shorturl.at/dfjt9
682 Baseball Game https://shorturl.at/acJ38
704 Binary Search https://shorturl.at/ehqxR
872 Leaf-Similar Trees https://shorturl.at/acdrN
997 Find the Town Judge https://shorturl.at/qtLQ1
1046 Last Stone Weight https://shorturl.at/dWXZ5
1863 Sum of All Subset XOR Totals https://shorturl.at/osHW5
2099 Find Subsequence of Length K With the Largest Sum https://shorturl.at/dprC8
2908 Check if Bitwise OR Has Trailing Zeros https://shorturl.at/moDWZ
2996 Smallest Missing Integer Greater Than Sequential Prefix Sum https://shorturl.at/iIMPX

MEDIUM

ID Title Solution Link
5 Longest Palindromic Substring https://shorturl.at/GNQX7
6 Zigzag Conversion https://shorturl.at/eRT13
24 Swap Nodes in Pairs https://shorturl.at/JNSW6
33 Search in Rotated Sorted Array https://shorturl.at/hjFYZ
34 Find First and Last Position of Element in Sorted Array https://shorturl.at/botP3
39 Combination Sum https://shorturl.at/uxJRU
46 Permutations https://shorturl.at/bpMPW
48 Rotate Image https://shorturl.at/cmrGU
53 Maximum Subarray https://shorturl.at/akl26
74 Search a 2D Matrix https://shorturl.at/gpN48
77 Combinations https://shorturl.at/bnzG9
78 Subsets https://shorturl.at/kpqvw
90 Subsets II https://shorturl.at/bkmoM
96 Unique Binary Search Trees https://shorturl.at/dAEUZ
102 Binary Tree Level Order Traversal https://shorturl.at/BFJT2
103 Binary Tree Zigzag Level Order Traversal https://shorturl.at/nsEOT
134 Gas Station https://shorturl.at/psJO9
148 Sort List https://shorturl.at/aqxFY
150 Evaluate Reverse Polish Notation https://shorturl.at/dkNWX
162 Find Peak Element https://shorturl.at/gqrE7
198 House Robber https://shorturl.at/tGS08
201 Bitwise AND of Numbers Range https://shorturl.at/bqyVW
230 Kth Smallest Element in a BST https://shorturl.at/bJLS2
237 Delete Node in a Linked List https://shorturl.at/aqsDY
240 Search a 2D Matrix II https://shorturl.at/lwMS1
241 Different Ways to Add Parentheses https://shorturl.at/kstC2
287 Find the Duplicate Number https://shorturl.at/psDNW
337 House Robber III https://shorturl.at/knHLY
347 Top K Frequent Elements https://shorturl.at/awIPS
368 Largest Divisible Subset https://shorturl.at/juAKM
380 Insert Delete GetRandom O(1) https://shorturl.at/bBIUV
456 132 Pattern https://shorturl.at/afjJ4
486 Predict The Winner https://shorturl.at/frVZ0
503 Next Greater Element II https://shorturl.at/htJV6
513 Find Bottom Left Tree Value https://shorturl.at/kmuw6
560 Subarray Sum Equals K https://shorturl.at/eEQT2
576 Out of Boundary Paths https://shorturl.at/qBGT1
647 Palindromic Substrings https://shorturl.at/oyAN2
654 Maximum Binary Tree https://shorturl.at/beAN3
735 Asteroid Collision https://shorturl.at/ovDN7
739 Daily Temperatures https://shorturl.at/FIKPS
797 All Paths From Source to Target https://shorturl.at/mLMW2
826 Most Profit Assigning Work https://shorturl.at/gjnV0
875 Koko Eating Bananas https://shorturl.at/vLSU9
901 Online Stock Span https://shorturl.at/diGK5
918 Maximum Sum Circular Subarray https://shorturl.at/lpFQR
931 Minimum Falling Path Sum https://shorturl.at/gvR67
1011 Capacity To Ship Packages Within D Days https://shorturl.at/htxAH
1019 Next Greater Node In Linked List https://shorturl.at/pFMQ8
1026 Maximum Difference Between Node and Ancestor https://shorturl.at/GPV48
1043 Partition Array for Maximum Sum https://shorturl.at/boIV7
1079 Letter Tile Possibilities https://shorturl.at/morxV
1094 Car Pooling https://shorturl.at/ahlrw
1143 Longest Common Subsequence https://shorturl.at/npS35
1169 Invalid Transactions https://shorturl.at/itCST
1239 Maximum Length of a Concatenated String with Unique Characters https://shorturl.at/mJUX0
1302 Deepest Leaves Sum https://shorturl.at/kmrJT
1347 Minimum Number of Steps to Make Two Strings Anagram https://shorturl.at/swGU2
1448 Count Good Nodes in Binary Tree https://shorturl.at/ajn24
1457 Pseudo-Palindromic Paths in a Binary Tree https://shorturl.at/jxAQY
1552 Magnetic Force Between Two Balls https://shorturl.at/fhiqZ
1686 Stone Game VI https://shorturl.at/ktzBH
1922 Count Good Numbers https://shorturl.at/K2359
2064 Minimized Maximum of Products Distributed to Any Store https://shorturl.at/qDTZ9
2095 Delete the Middle Node of a Linked List https://shorturl.at/dfklA
2125 Number of Laser Beams in a Bank https://shorturl.at/sIUW5
2226 Maximum Candies Allocated to K Children https://shorturl.at/lvBC4
2385 Amount of Time for Binary Tree to Be Infected https://shorturl.at/aciz2
2550 Count Collisions of Monkeys on a Polygon https://shorturl.at/coAFL
2594 Minimum Time to Repair Cars https://shorturl.at/dAKLZ
2870 Minimum Number of Operations to Make Array Empty https://shorturl.at/puKV5
2966 Divide Array Into Arrays With Max Difference https://shorturl.at/buyUV
2981 Find Longest Special Substring That Occurs Thrice I https://shorturl.at/jtv04
2982 Find Longest Special Substring That Occurs Thrice II https://shorturl.at/diqBK
2997 Minimum Number of Operations to Make Array XOR Equal to K https://shorturl.at/dinrV
2998 Minimum Number of Operations to Make X and Y Equal https://shorturl.at/stJV1

HARD

ID Title Solution Link
4 Median of Two Sorted Arrays https://shorturl.at/styQT
23 Merge k Sorted Lists https://shorturl.at/DGO68
25 Reverse Nodes in k-Group https://shorturl.at/cPRZ1
32 Longest Valid Parentheses https://shorturl.at/brC37
37 Sudoku Solver https://shorturl.at/jknP4
41 First Missing Positive https://shorturl.at/bfCGO
42 Trapping Rain Water https://shorturl.at/bKW59
51 N-Queens https://shorturl.at/ceoI4
52 N-Queens II https://shorturl.at/demDQ
76 Minimum Window Substring https://shorturl.at/bmAMY
84 Largest Rectangle in Histogram https://shorturl.at/ioqRW
124 Binary Tree Maximum Path Sum https://shorturl.at/doTU1
127 Word Ladder https://shorturl.at/csNW7
135 Candy https://shorturl.at/nrtHK
154 Find Minimum in Rotated Sorted Array II https://shorturl.at/dzL16
218 The Skyline Problem https://shorturl.at/gmrE5
239 Sliding Window Maximum https://shorturl.at/evD08
295 Find Median from Data Stream https://shorturl.at/knsH7
354 Russian Doll Envelopes https://shorturl.at/djRS4
410 Split Array Largest Sum https://shorturl.at/myUY0
432 All O'one Data Structure https://shorturl.at/dlpS7
493 Reverse Pairs https://shorturl.at/cpQX6
629 K Inverse Pairs Array https://shorturl.at/fhWY7
719 Find K-th Smallest Pair Distance https://shorturl.at/iNOW1
857 Minimum Cost to Hire K Workers https://shorturl.at/bdKQV
862 Shortest Subarray with Sum at Least K https://shorturl.at/gjvxS
871 Minimum Number of Refueling Stops https://shorturl.at/S1457
887 Super Egg Drop https://shorturl.at/ekyEW
980 Unique Paths III https://shorturl.at/jnuV4
987 Vertical Order Traversal of a Binary Tree https://shorturl.at/dlqBI
1793 Maximum Score of a Good Subarray https://shorturl.at/gqt19
2402 Meeting Rooms III https://shorturl.at/ejsU5
2421 Number of Good Paths https://shorturl.at/inRV6
2858 Minimum Edge Reversals So Every Node Is Reachable https://shorturl.at/ckDL9