└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # Leetcode-Community-Solutions 2 | 3 | ### Intuitions, approaches and code for **Leetcode Problems** which have been explained by me with solutions. Divided based on difficulty to easily access different questions. 4 | 5 | ### Leetcode Profile: https://leetcode.com/darkaadityaa/ 6 | 7 |
8 | 9 | ##### Note: 10 | 11 | #### *If you find this repository helpful, consider giving it a star!* 12 | 13 | #### *If you find my solutions helpful, consider giving them upvotes!* 14 | 15 | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 16 | 17 | ## EASY 18 | 19 | | ID | Title | Solution Link | 20 | | :---: | --- | --- | 21 | | `20` | Valid Parentheses | https://shorturl.at/eiruT | 22 | | `21` | Merge Two Sorted Lists | https://shorturl.at/agvy0 | 23 | | `35` | Search Insert Position | https://shorturl.at/efqvy | 24 | | `69` | Sqrt(x) | https://shorturl.at/oyLTW | 25 | | `94` | Binary Tree Inorder Traversal | https://shorturl.at/IQ089 | 26 | | `100` | Same Tree | https://shorturl.at/zALSZ | 27 | | `101` | Symmetric Tree | https://shorturl.at/ahxAP | 28 | | `104` | Maximum Depth of Binary Tree | https://shorturl.at/acmsZ | 29 | | `112` | Path Sum | https://shorturl.at/rDFMR | 30 | | `160` | Intersection of Two Linked Lists | https://shorturl.at/izX46 | 31 | | `202` | Happy Number | https://shorturl.at/degtY | 32 | | `206` | Reverse Linked List | https://shorturl.at/lqt78 | 33 | | `226` | Invert Binary Tree | https://shorturl.at/hrDJ2 | 34 | | `232` | Implement Queue using Stacks | https://shorturl.at/fmKN3 | 35 | | `326` | Power of Three | https://shorturl.at/vwxN1 | 36 | | `401` | Binary Watch | https://shorturl.at/abAN6 | 37 | | `404` | Sum of Left Leaves | https://shorturl.at/dpES6 | 38 | | `509` | Fibonacci Number | https://shorturl.at/copy2 | 39 | | `543` | Diameter of Binary Tree | https://shorturl.at/dfjt9 | 40 | | `682` | Baseball Game | https://shorturl.at/acJ38 | 41 | | `704` | Binary Search | https://shorturl.at/ehqxR | 42 | | `872` | Leaf-Similar Trees | https://shorturl.at/acdrN | 43 | | `997` | Find the Town Judge | https://shorturl.at/qtLQ1 | 44 | | `1046` | Last Stone Weight | https://shorturl.at/dWXZ5 | 45 | | `1863` | Sum of All Subset XOR Totals | https://shorturl.at/osHW5 | 46 | | `2099` | Find Subsequence of Length K With the Largest Sum | https://shorturl.at/dprC8 | 47 | | `2908` | Check if Bitwise OR Has Trailing Zeros | https://shorturl.at/moDWZ | 48 | | `2996` | Smallest Missing Integer Greater Than Sequential Prefix Sum | https://shorturl.at/iIMPX | 49 | 50 | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 51 | 52 | ## MEDIUM 53 | 54 | | ID | Title | Solution Link | 55 | | :---: | --- | --- | 56 | | `5` | Longest Palindromic Substring | https://shorturl.at/GNQX7 | 57 | | `6` | Zigzag Conversion | https://shorturl.at/eRT13 | 58 | | `24` | Swap Nodes in Pairs | https://shorturl.at/JNSW6 | 59 | | `33` | Search in Rotated Sorted Array | https://shorturl.at/hjFYZ | 60 | | `34` | Find First and Last Position of Element in Sorted Array | https://shorturl.at/botP3 | 61 | | `39` | Combination Sum | https://shorturl.at/uxJRU | 62 | | `46` | Permutations | https://shorturl.at/bpMPW | 63 | | `48` | Rotate Image | https://shorturl.at/cmrGU | 64 | | `53` | Maximum Subarray | https://shorturl.at/akl26 | 65 | | `74` | Search a 2D Matrix | https://shorturl.at/gpN48 | 66 | | `77` | Combinations | https://shorturl.at/bnzG9 | 67 | | `78` | Subsets | https://shorturl.at/kpqvw | 68 | | `90` | Subsets II | https://shorturl.at/bkmoM | 69 | | `96` | Unique Binary Search Trees | https://shorturl.at/dAEUZ | 70 | | `102` | Binary Tree Level Order Traversal | https://shorturl.at/BFJT2 | 71 | | `103` | Binary Tree Zigzag Level Order Traversal | https://shorturl.at/nsEOT | 72 | | `134` | Gas Station | https://shorturl.at/psJO9 | 73 | | `148` | Sort List | https://shorturl.at/aqxFY | 74 | | `150` | Evaluate Reverse Polish Notation | https://shorturl.at/dkNWX | 75 | | `162` | Find Peak Element | https://shorturl.at/gqrE7 | 76 | | `198` | House Robber | https://shorturl.at/tGS08 | 77 | | `201` | Bitwise AND of Numbers Range | https://shorturl.at/bqyVW | 78 | | `230` | Kth Smallest Element in a BST | https://shorturl.at/bJLS2 | 79 | | `237` | Delete Node in a Linked List | https://shorturl.at/aqsDY | 80 | | `240` | Search a 2D Matrix II | https://shorturl.at/lwMS1 | 81 | | `241` | Different Ways to Add Parentheses | https://shorturl.at/kstC2 | 82 | | `287` | Find the Duplicate Number | https://shorturl.at/psDNW | 83 | | `337` | House Robber III | https://shorturl.at/knHLY | 84 | | `347` | Top K Frequent Elements | https://shorturl.at/awIPS | 85 | | `368` | Largest Divisible Subset | https://shorturl.at/juAKM | 86 | | `380` | Insert Delete GetRandom O(1) | https://shorturl.at/bBIUV | 87 | | `456` | 132 Pattern | https://shorturl.at/afjJ4 | 88 | | `486` | Predict The Winner | https://shorturl.at/frVZ0 | 89 | | `503` | Next Greater Element II | https://shorturl.at/htJV6 | 90 | | `513` | Find Bottom Left Tree Value | https://shorturl.at/kmuw6 | 91 | | `560` | Subarray Sum Equals K | https://shorturl.at/eEQT2 | 92 | | `576` | Out of Boundary Paths | https://shorturl.at/qBGT1 | 93 | | `647` | Palindromic Substrings | https://shorturl.at/oyAN2 | 94 | | `654` | Maximum Binary Tree | https://shorturl.at/beAN3 | 95 | | `735` | Asteroid Collision | https://shorturl.at/ovDN7 | 96 | | `739` | Daily Temperatures | https://shorturl.at/FIKPS | 97 | | `797` | All Paths From Source to Target | https://shorturl.at/mLMW2 | 98 | | `826` | Most Profit Assigning Work | https://shorturl.at/gjnV0 | 99 | | `875` | Koko Eating Bananas | https://shorturl.at/vLSU9 | 100 | | `901` | Online Stock Span | https://shorturl.at/diGK5 | 101 | | `918` | Maximum Sum Circular Subarray | https://shorturl.at/lpFQR | 102 | | `931` | Minimum Falling Path Sum | https://shorturl.at/gvR67 | 103 | | `1011` | Capacity To Ship Packages Within D Days | https://shorturl.at/htxAH | 104 | | `1019` | Next Greater Node In Linked List | https://shorturl.at/pFMQ8 | 105 | | `1026` | Maximum Difference Between Node and Ancestor | https://shorturl.at/GPV48 | 106 | | `1043` | Partition Array for Maximum Sum | https://shorturl.at/boIV7 | 107 | | `1079` | Letter Tile Possibilities | https://shorturl.at/morxV | 108 | | `1094` | Car Pooling | https://shorturl.at/ahlrw | 109 | | `1143` | Longest Common Subsequence | https://shorturl.at/npS35 | 110 | | `1169` | Invalid Transactions | https://shorturl.at/itCST | 111 | | `1239` | Maximum Length of a Concatenated String with Unique Characters | https://shorturl.at/mJUX0 | 112 | | `1302` | Deepest Leaves Sum | https://shorturl.at/kmrJT | 113 | | `1347` | Minimum Number of Steps to Make Two Strings Anagram | https://shorturl.at/swGU2 | 114 | | `1448` | Count Good Nodes in Binary Tree | https://shorturl.at/ajn24 | 115 | | `1457` | Pseudo-Palindromic Paths in a Binary Tree | https://shorturl.at/jxAQY | 116 | | `1552` | Magnetic Force Between Two Balls | https://shorturl.at/fhiqZ | 117 | | `1686` | Stone Game VI | https://shorturl.at/ktzBH | 118 | | `1922` | Count Good Numbers | https://shorturl.at/K2359 | 119 | | `2064` | Minimized Maximum of Products Distributed to Any Store | https://shorturl.at/qDTZ9 | 120 | | `2095` | Delete the Middle Node of a Linked List | https://shorturl.at/dfklA | 121 | | `2125` | Number of Laser Beams in a Bank | https://shorturl.at/sIUW5 | 122 | | `2226` | Maximum Candies Allocated to K Children | https://shorturl.at/lvBC4 | 123 | | `2385` | Amount of Time for Binary Tree to Be Infected | https://shorturl.at/aciz2 | 124 | | `2550` | Count Collisions of Monkeys on a Polygon | https://shorturl.at/coAFL | 125 | | `2594` | Minimum Time to Repair Cars | https://shorturl.at/dAKLZ | 126 | | `2870` | Minimum Number of Operations to Make Array Empty | https://shorturl.at/puKV5 | 127 | | `2966` | Divide Array Into Arrays With Max Difference | https://shorturl.at/buyUV | 128 | | `2981` | Find Longest Special Substring That Occurs Thrice I | https://shorturl.at/jtv04 | 129 | | `2982` | Find Longest Special Substring That Occurs Thrice II | https://shorturl.at/diqBK | 130 | | `2997` | Minimum Number of Operations to Make Array XOR Equal to K | https://shorturl.at/dinrV | 131 | | `2998` | Minimum Number of Operations to Make X and Y Equal | https://shorturl.at/stJV1 | 132 | 133 | 134 | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 135 | 136 | ## HARD 137 | 138 | | ID | Title | Solution Link | 139 | | :---: | --- | --- | 140 | | `4` | Median of Two Sorted Arrays | https://shorturl.at/styQT | 141 | | `23` | Merge k Sorted Lists | https://shorturl.at/DGO68 | 142 | | `25` | Reverse Nodes in k-Group | https://shorturl.at/cPRZ1 | 143 | | `32` | Longest Valid Parentheses | https://shorturl.at/brC37 | 144 | | `37` | Sudoku Solver | https://shorturl.at/jknP4 | 145 | | `41` | First Missing Positive | https://shorturl.at/bfCGO | 146 | | `42` | Trapping Rain Water | https://shorturl.at/bKW59 | 147 | | `51` | N-Queens | https://shorturl.at/ceoI4 | 148 | | `52` | N-Queens II | https://shorturl.at/demDQ | 149 | | `76` | Minimum Window Substring | https://shorturl.at/bmAMY | 150 | | `84` | Largest Rectangle in Histogram | https://shorturl.at/ioqRW | 151 | | `124` | Binary Tree Maximum Path Sum | https://shorturl.at/doTU1 | 152 | | `127` | Word Ladder | https://shorturl.at/csNW7 | 153 | | `135` | Candy | https://shorturl.at/nrtHK | 154 | | `154` | Find Minimum in Rotated Sorted Array II | https://shorturl.at/dzL16 | 155 | | `218` | The Skyline Problem | https://shorturl.at/gmrE5 | 156 | | `239` | Sliding Window Maximum | https://shorturl.at/evD08 | 157 | | `295` | Find Median from Data Stream | https://shorturl.at/knsH7 | 158 | | `354` | Russian Doll Envelopes | https://shorturl.at/djRS4 | 159 | | `410` | Split Array Largest Sum | https://shorturl.at/myUY0 | 160 | | `432` | All O'one Data Structure | https://shorturl.at/dlpS7 | 161 | | `493` | Reverse Pairs | https://shorturl.at/cpQX6 | 162 | | `629` | K Inverse Pairs Array | https://shorturl.at/fhWY7 | 163 | | `719` | Find K-th Smallest Pair Distance | https://shorturl.at/iNOW1 | 164 | | `857` | Minimum Cost to Hire K Workers | https://shorturl.at/bdKQV | 165 | | `862` | Shortest Subarray with Sum at Least K | https://shorturl.at/gjvxS | 166 | | `871` | Minimum Number of Refueling Stops | https://shorturl.at/S1457 | 167 | | `887` | Super Egg Drop | https://shorturl.at/ekyEW | 168 | | `980` | Unique Paths III | https://shorturl.at/jnuV4 | 169 | | `987` | Vertical Order Traversal of a Binary Tree | https://shorturl.at/dlqBI | 170 | | `1793` | Maximum Score of a Good Subarray | https://shorturl.at/gqt19 | 171 | | `2402` | Meeting Rooms III | https://shorturl.at/ejsU5 | 172 | | `2421` | Number of Good Paths | https://shorturl.at/inRV6 | 173 | | `2858` | Minimum Edge Reversals So Every Node Is Reachable | https://shorturl.at/ckDL9 | 174 | 175 | 176 | 177 | 178 | --------------------------------------------------------------------------------