Skip to content

MonitSharma/LeetCode-Solutions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

←←Back to Homepage

Leetcode Solutions Repository

Leetcode Solutions Repository is a GitHub repository that provides solutions to problems found on the popular coding platform, Leetcode. The repository contains solutions in various programming languages such as Python, C, C++, Java, and JavaScript.

Leetcode Stats

Introduction

Leetcode is an online platform where programmers can practice their coding skills by solving algorithmic problems. The platform provides a vast array of problems, ranging from easy to hard, in various categories such as arrays, strings, linked lists, trees, graphs, and more.

This repository contains solutions to over 500 Leetcode problems that are organized by problem difficulty and category, making it easier for users to navigate and find solutions to the problems they are interested in. The solutions are written in easy-to-read and well-commented code, and each solution includes an explanation of the problem statement and approach.

Features

  • Solutions to over 500+ Leetcode problems
  • Solutions in Python, C, C++, Java, and JavaScript
  • Easy-to-read and well-commented code
  • Explanation of the problem statement and approach
  • Regularly updated with new solutions

Solutions and Articles

Problem number Leetcode Problem Medium Article
4 Median of Two Sorted Arrays Medium
5 Longest Palindromic Substring Medium
17 Letter Combinations of Phone Number Medium
24 Swap Nodes in Pairs Medium
33 Search in Rotated Sorted Array Medium
34 Find First and Last Position of Element in Sorted Array Medium
46 Permutations Medium
50 Pow(x,n) Medium
54 Spiral Matrix Medium
59 Spiral Matrix II Medium
63 Unique Paths II Medium
68 Text Justification Medium
71 Simplifying Path Medium
74 Search a 2D Matrix Medium
77 Combinations Medium
81 Search in Rotated Sorted Array II Medium
86 Partition List Medium
92 Reverse Linked List II Medium
95 Unique Binary Search Trees II Medium
97 Interleaving Strings Medium
111 Minimum Depth of a Binary Tree Medium
118 Pascal's Triangle Medium
119 Pascal's Triangle II Medium
135 Candy Medium
137 Single Number II Medium
138 Copy list with Random Pointer Medium
139 Word break Medium
141 Linked List Cycle Medium
146 LRU Cache Medium
168 Excel Sheet Column Title Medium
207 Course Schedule Medium
209 Minimum Size Subarray Sum Medium
215 Kth Largest element in an array Medium
225 Implement Stack using Queues Medium
228 Summary Ranges Medium
239 Sliding Window Maximum Medium
258 Add Digits Medium
287 Find the Duplicate Number Medium
316 Remove Duplicate Letters Medium
319 Bulb Switcher Medium
332 Reconstruct Itinerary Medium
338 Counting Bits Medium
341 Flatten Nested List Iterator Medium
342 Power of Four Medium
343 Integer Break Medium
347 Top K Frequent Elements Medium
373 Find K Pairs with Smallest Sums Medium
389 Find the Difference Medium
392 Is Subsequence Medium
399 Evaluate Division Medium
403 Frog Jump Medium
435 Non Overlapping Intervals Medium
445 Add two numbers II Medium
459 Repeated Substring Patterns Medium
486 Predict the Winner Medium
501 Find Mode in Binary Search Tree Medium
515 Find Largest Value in Each Tree Row Medium
516 Longest Palindromic Subsequence Medium
518 Coin Change II Medium
530 Minimum Absolute Difference in BST Medium
542 01 Matrix Medium
547 Number of Provinices Medium
646 Maximum Length of a Pair Chain Medium
649 Dota2 Senate Medium
662 Maximum Width of Binary Tree Medium
664 Maximum Width of Binary Tree Medium
673 Number of Longest Increasing Sub-sequences Medium
688 Knight Probability in Chessboard Medium
703 Kth Largest element in a stream Medium
705 Design Hashset Medium
706 Design Hashmap Medium
712 Minimum ASCII Delete Sum for Two Strings Medium
714 Best Time to Buy and Sell Stock with Transaction Fee Medium
725 Split Linked List in Parts Medium
735 Asteroid Collision Medium
744 Find samllest letter greater than target Medium
746 Min Cost Climbing Stairs Medium
758 Is Graph Bipartite? Medium
767 Reorganize String Medium
779 K-th Symbol in Grammar Medium
802 Find Eventual Safe States Medium
808 Soup Servings Medium
823 Binary Tree with Factors Medium
837 New 21 Game Medium
839 Similar String Groups Medium
844 Backspace String Compare Medium
852 Peak Index in a Mountain Array Medium
859 Buddy Strings Medium
863 All Nodes Distance K in Binary Tree Medium
864 Shortest Path to Get All Keys Medium
879 Profitable Schemes Medium
880 Decoded String at Index Medium
894 All Possible Full Binary Trees Medium
896 Monotonic Array Medium
920 Number of Music Playlist Medium
934 Shortest Bridge Medium
946 Validate Stack Sequences Medium
956 Tallest Billboard Medium
1027 Longest Arithmetic Subsequence Medium
1035 Uncrossed Lines Medium
1046 Last Stone Weight Medium
1091 Shortest Path in Binary Matrix Medium
1095 Find in Mountain Array Medium
1125 Smallest Sufficient Team Medium
1140 Stone Game II Medium
1146 Snapshot Array Medium
1161 Maximum Level Sum of a Binary Tree Medium
1187 Make Array Strictly Increasing Medium
1203 Sort Items by Groups Respecting Dependencies Medium
1218 Longest Arithmetic Subsequence of Given Difference Medium
1232 Check If It Is a Straight Line Medium
1282 Group the People Given the Group Size They Belong To Medium
1312 Minimum Insertion Steps to Make a String Palindrome Medium
1318 Minimum Flips to Make a OR b Equal to c Medium
1326 Minimum Number of Taps to Open to Water a Garden Medium
1337 The K Weakest Rows in a Matrix Medium
1351 Count Negative Numbers in a Sorted Matrix Medium
1361 Validate Binary Tree Nodes Medium
1372 Longest ZigZag Path in a Binary Tree Medium
1376 Time needed to inform all employees Medium
1396 Design Underground System Medium
1406 Stone Game III Medium
1416 Restore The Array Medium
1431 Kids With the Greatest Number of Candies Medium
1456 Maximum Number of Vowels in a Substring of Given Length Medium
1489 Find Critical and Pseudo Critical Edges in Minimum Spanning Tree Medium
1491 Average Salary Excluding the Minimum and Maximum Salary Medium
1493 Longest Subarray of 1’s After Deleting One Element Medium
1498 Number of Subsequences That Satisfy the Given Sum Condition Medium
1502 Can Make Arithemetic Progressions from a Sequence Medium
1512 Number of Good Pairs Medium
1514 Path with Maximum Probability Medium
1547 Minimum Cost to cut a stick Medium
1569 Number of Ways to Reorder Array to Get Same BST Medium
1572 Matrix Diagonal Sum Medium
1575 Count All Possible Routes Medium
1577 Maximum number of vertices to Reach all nodes Medium
1579 Remove Max Number of Edges to Keep Graph Fully Traversable Medium
1584 Min Cost to Connect All Points Medium
1601 Maximum Number of Achievable Transfer Requests Medium
1603 Design Parking System Medium
1615 Maximal Network Rank Medium
1639 Number of Ways to Form a Target String Given a Dictionary Medium
1647 Minimum Deletions to Make Character Frequencies Unique Medium
1658 Minimum Operations to Reduce X to Zero Medium
1697 Checking the Existence of Edge Length Limited Paths Medium
1721 Swapping Nodes in a Linked List Medium
1732 Find the highest Altitude Medium
1751 Maximum Number of Events That Can Be Attended II Medium
1768 Merge Strings Alternately Medium
1799 Maximize score after N Operations Medium
1802 Maximum Value at a Given Index in a Bounded Array Medium
1822 Sign of the Product of an Array Medium
1870 Minimum Speed to Arrive on Time Medium
1964 Find the Longest Valid Obstacle Course at Each Position Medium
1970 Last Day Where You Can Still Cross Medium
2009 Minimum Number of Operations to Make Array Continuous Medium
2022 Convert 1D Array Into 2D Array Medium
2028 Find Missing Observation Medium
2024 Maximize the confusion of an Exam Medium
2038 Remove Colored Pieces if Both Neighbors are the same color Medium
2050 Parallel Courses III Medium
2090 K Radius Subarray Averages Medium
2101 Detonate the Maximum Bombs Medium
2130 Maximum Twin sum of a Linked List Medium
2140 Solving Questions with Brainpower Medium
2141 Maximum Running time for N Computers Medium
2215 Find the Difference of Two Arrays Medium
2218 Maximum Value of K Coins From Piles Medium
2251 Number of Flowers in Full Bloom Medium
2272 Substring With Largest Variance Medium
2305 Fair Distribution of Cookies Medium
2328 Number of Increasing Paths in a Grid Medium
2336 Smallest Number in Infinite Set Medium
2352 Equal Row and Column Pairs Medium
2366 Minimum Replacements to Sort the Array Medium
2369 Check if there is a Valid Partition For The Array Medium
2433 Find The Original Array of Prefix Xor Medium
2448 Minimum Cost to Make Array Equal Medium
2462 Total Cost to Hire K Workers Medium
2466 Count Ways To Build Good Strings Medium
2483 Minimum Penalty for a shop Medium
2542 Maximum Subsequence Score Medium
2551 Put Marbles in Bags Medium
2616 Minimize the Maximum difference in pairs Medium
2707 Extra Characters in a String Medium

Usage

This repository can be used in various ways:

  • As a reference for Leetcode problems: Users can browse the repository to find solutions to the problems they are interested in. The solutions are well-commented, making it easier for users to understand the approach and implementation.

  • To improve coding skills: Users can use the solutions in this repository to learn new techniques and approaches to solving algorithmic problems. The code is easy to read and understand, making it a great resource for improving coding skills.

  • To contribute to the repository: Users can contribute to the repository by adding solutions to new or existing problems. This can help other users who may be stuck on a particular problem.

Contributing

Contributions to this repository are always welcome. Users can contribute by adding solutions to new or existing problems in any of the supported programming languages. Before contributing, please make sure to read the contribution guidelines.

License

This repository is licensed under the MIT License. Users are free to use, modify, and distribute the code in this repository as long as they comply with the terms of the license.

Conclusion

Leetcode Solutions Repository is a great resource for programmers who are looking to improve their coding skills or to find solutions to Leetcode problems. With over 1000 solutions in different programming languages, this repository is a valuable asset for any programmer.


Current Stats

Current rank : 83,730

  • There are new LeetCode questions every day. I'll keep updating them with solutions in different programming languages