Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bashmocha/leetcode-solutions

Solutions to Leetcode problems; updated daily
https://github.com/bashmocha/leetcode-solutions

algorithms-and-data-structures leetcode leetcode-solutions python3

Last synced: about 1 month ago
JSON representation

Solutions to Leetcode problems; updated daily

Awesome Lists containing this project

README

        

# Leetcode solutions

Solutions to LeetCode problems done by [me](https://leetcode.com/CheesyFrappe/). All of the problems are done in Python3.

You can take a look at my [cheat sheet](https://docs.google.com/spreadsheets/d/1ynFoTR0QUidBiOjPXEDPs7hjLxxoR8kRZ3GejIKJf7E/edit?usp=sharing) that I take notes for each problem.

![LeetCode Stats](https://leetcard.jacoblin.cool/CheesyFrappe?theme=unicorn&font=Roboto&ext=heatmap)

---

| # | Title | Solution | Difficulty |
|---| ----- | -------- | ---------- |
|136|[Single Number](https://leetcode.com/problems/single-number/) | [Python](./python3/array/singleNumber.py)|Easy|
|217|[Contains Duplicate](https://leetcode.com/problems/contains-duplicate/) | [Python](./python3/array/containsDuplicate.py)|Easy|
|219|[Contains Duplicate II](https://leetcode.com/problems/contains-duplicate-ii/) | [Python](./python3/array/containsDuplicateII.py)|Easy|
|118|[Pascal's Triangle](https://leetcode.com/problems/pascals-triangle/) | [Python](./python3/array/pascalsTriangle.py)|Easy|
|119|[Pascal's Triangle II](https://leetcode.com/problems/pascals-triangle-ii/) | [Python](./python3/array/pascalsTriangleII.py)|Easy|
|268|[Missing Number](https://leetcode.com/problems/missing-number/) | [Python](./python3/array/missingNumber.py)|Easy|
|283|[Move Zeroes](https://leetcode.com/problems/move-zeroes/) | [Python](./python3/array/moveZeroes.py)|Easy|
|349|[Intersection of Two Arrays](https://leetcode.com/problems/intersection-of-two-arrays/) | [Python](./python3/array/intersectionOfTwoArrays.py)|Easy|
|343|[Integer Break](https://leetcode.com/problems/integer-break/) | [Python](./python3/dynamic%20programming/integerBreak.py)|Medium|
|350|[Intersection of Two Arrays II](https://leetcode.com/problems/intersection-of-two-arrays-ii/) | [Python](./python3/array/intersectionOfTwoArraysII.py)|Easy|
|414|[Third Maximum Number](https://leetcode.com/problems/third-maximum-number/) | [Python](./python3/array/thirdMaximumNumber.py)|Easy|
|448|[Find All Numbers Disappeared in an Array](https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/) | [Python](./python3/array/findAllNumbersDisappearedInArray.py)|Easy|
|34|[Find First and Last Position of Element in Sorted Array](https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/) | [Python](./python3/array/findFirstAndLastPosition.py)|Medium|
|347|[Top K Frequent Elements](https://leetcode.com/problems/top-k-frequent-elements/) | [Python](./python3/array/topKFrequentElements.py)|Medium|
|238|[Product of Arrat Except Self](https://leetcode.com/problems/product-of-array-except-self/) | [Python](./python3/array/productOfArrayExceptSelf.py)|Medium|
|1929|[Concatenation Of Array](https://leetcode.com/problems/concatenation-of-array/) | [Python](./python3/array/concatenationOfArray.py)|Easy|
|1876|[Substrings of Size Three with Distinct Characters](https://leetcode.com/problems/substrings-of-size-three-with-distinct-characters/) | [Python](./python3/array/substringsOfSizeThree.py)|Easy|
|643|[Maximum Average Subarray I](https://leetcode.com/problems/maximum-average-subarray-i/) | [Python](./python3/array/maximumAverageSubarrayI.py)|Easy|
|121|[Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/) | [Python](./python3/array/bestTimeToBuyAndSellStock.py)|Easy|
|3|[Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters) | [Python](./python3/sliding%20window/longestSubstringWithoutRepeatingChars.py)|Medium|
|125|[Valid Palindrome](https://leetcode.com/problems/valid-palindrome) | [Python](./python3/two%20pointers/validPalindrome.py)|Easy|
|424|[Longest Repeating Character Replacement](https://leetcode.com/problems/longest-repeating-character-replacement) | [Python](./python3/sliding%20window/longestRepeatingCharReplacement.py)|Medium|
|49|[Group Anagrams](https://leetcode.com/problems/group-anagrams) | [Python](./python3/hash%20map/groupAnagrams.py)|Medium|
|128|[Group Anagrams](https://leetcode.com/problems/longest-consecutive-sequence) | [Python](./python3/array/longestConsecutiveSequence.py)|Medium|
|88|[Merge Sorted Array](https://leetcode.com/problems/merge-sorted-array) | [Python](./python3/array/mergeSortedArray.py)|Easy|
|20|[Valid Parentheses](https://leetcode.com/problems/valid-parentheses) | [Python](./python3/stack/validParentheses.py)|Easy|
|155|[Min Stack](https://leetcode.com/problems/min-stack) | [Python](./python3/stack/minStack.py)|Medium|
|150|[Evaluate Reverse Polish Notation](https://leetcode.com/problems/evaluate-reverse-polish-notation) | [Python](./python3/stack/evalRPN.py)|Medium|
|255|[Implement Stack using Queues](https://leetcode.com/problems/implement-stack-using-queues) | [Python](./python3/stack/implementStackUsingQueues.py)|Easy|
|22|[Generate Parentheses](https://leetcode.com/problems/generate-parentheses) | [Python](./python3/stack/generateParentheses.py)|Medium|
|496|[Next Greater Element I](https://leetcode.com/problems/next-greater-element-i) | [Python](./python3/stack/nextGreaterElementI.py)|Easy|
|1475|[Final Prices With a Special Discount in a Shop](https://leetcode.com/problems/final-prices-with-a-special-discount-in-a-shop) | [Python](./python3/stack/FinalPricesWithDiscount.py)|Easy|
|94|[Binary Tree Inorder Traversal](https://leetcode.com/problems/binary-tree-inorder-traversal) | [Python](./python3/tree/inorderTraversal.py)|Easy|
|144|[Binary Tree Preorder Traversal](https://leetcode.com/problems/binary-tree-preorder-traversal) | [Python](./python3/tree/preorderTraversal.py)|Easy|
|145|[Binary Tree Postorder Traversal](https://leetcode.com/problems/binary-tree-postorder-traversal) | [Python](./python3/tree/postorderTraversal.py)|Easy|
|1913|[Maximum Product Difference Between Two Pairs](https://leetcode.com/problems/maximum-product-difference-between-two-pairs) | [Python](./python3/array/maxProductDifference.py)|Easy|
|100|[Same Tree](https://leetcode.com/problems/same-tree) | [Python](./python3/tree/sameTree.py)|Easy|
|102|[Binary Tree Level Order Traversal](https://leetcode.com/problems/binary-tree-level-order-traversal) | [Python](./python3/tree/levelOrderTraversal.py)|Medium|
|104|[Maximum Depth of Binary Tree](https://leetcode.com/problems/maximum-depth-of-binary-tree) | [Python](./python3/tree/maxDepthofBinaryTree.py)|Easy|
|101|[Symmetric Tree](https://leetcode.com/problems/symmetric-tree) | [Python](./python3/tree/symmetricTree.py)|Easy|
|226|[Invert Binary Tree](https://leetcode.com/problems/invert-binary-tree) | [Python](./python3/tree/invertBinaryTree.py)|Easy|
|108|[Convert Sorted Array to Binary Search Tree](https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree) | [Python](./python3/tree/convertSortedArrToTree.py)|Easy|
|344|[Reverse String](https://leetcode.com/problems/reverse-string) | [Python](./python3/string/reverseString.py)|Easy|
|9|[Palindrome Number](https://leetcode.com/problems/palindrome-number) | [Python](./python3/math/palindromeNumber.py)|Easy|
|222|[Count Complete Tree Nodes](https://leetcode.com/problems/count-complete-tree-nodes) | [Python](./python3/tree/countCompleteTreeNodes.py)|Easy|
|257|[Binary Tree Paths](https://leetcode.com/problems/binary-tree-paths) | [Python](./python3/tree/binaryTreePaths.py)|Easy|
|21|[Merge Two Sorted Lists](https://leetcode.com/problems/merge-two-sorted-lists) | [Python](./python3/linked%20list/mergeTwoSortedLists.py)|Easy|
|112|[Path Sum](https://leetcode.com/problems/path-sum) | [Python](./python3/tree/pathSum.py)|Easy|
|404|[Sum of Left Leaves](https://leetcode.com/problems/sum-of-left-leaves) | [Python](./python3/tree/sumOfLeftLeaves.py)|Easy|
|645|[Set Mismatch](https://leetcode.com/problems/set-mismatch) | [Python](./python3/array/setMismatch.py)|Easy|
|1108|[Defanging an IP Address](https://leetcode.com/problems/defanging-an-ip-address/) | [Python](./python3/string/defangeIPAddress.py)|Easy|
|501|[Find Mode in Binary Search Tree](https://leetcode.com/problems/find-mode-in-binary-search-tree/) | [Python](./python3/tree/findModeinBST.py)|Easy|
|530|[Minimum Difference in BST](https://leetcode.com/problems/minimum-absolute-difference-in-bst/) | [Python](./python3/tree/minAbsoluteDifference.py)|Easy|
|1379|[Find a Corresponding Node of a Binary Tree in a Clone of That Tree](https://leetcode.com/problems/find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree/) | [Python](./python3/tree/findACorrespondingNode.py)|Easy|
|543|[Diameter of Binary Tree](https://leetcode.com/problems/diameter-of-binary-tree/) | [Python](./python3/tree/diameterOfBinaryTree.py)|Easy|
|617|[Merge Two Binary Trees](https://leetcode.com/problems/merge-two-binary-trees/) | [Python](./python3/tree/mergeTwoBinaryTrees.py)|Easy|
|700|[Search in a Binary Search Tree](https://leetcode.com/problems/search-in-a-binary-search-tree/) | [Python](./python3/tree/searchInBST.py)|Easy|
|232|[Implement Queue using Stacks](https://leetcode.com/problems/implement-queue-using-stacks/) | [Python](./python3/queue/implementQueueUsingStacks.py)|Easy|
|637|[Average of Levels in Binary Tree](https://leetcode.com/problems/average-of-levels-in-binary-tree/) | [Python](./python3/tree/avgOfLevelsInTree.py)|Easy|
|563|[Binary Tree Tilt](https://leetcode.com/problems/binary-tree-tilt/) | [Python](./python3/tree/binaryTreeTilt.py)|Easy|
|653|[Two Sum IV - Input is a BST](https://leetcode.com/problems/two-sum-iv-input-is-a-bst/) | [Python](./python3/tree/twoSumIV.py)|Easy|
|1791|[Find Center of Star Graph](https://leetcode.com/problems/find-center-of-star-graph/) | [Python](./python3/graph/findCenterOfStarGraph.py)|Easy|
|1971|[Find if Path Exists in Graph](https://leetcode.com/problems/find-if-path-exists-in-graph/) | [Python](./python3/graph/findIfPathExists.py)|Easy|
|997|[Find the Town Judge](https://leetcode.com/problems/find-the-town-judge/) | [Python](./python3/graph/findTheTownJudge.py)|Easy|
|133|[Clone Graph](https://leetcode.com/problems/clone-graph) | [Python](./python3/graph/cloneGraph.py)|Easy|
|207|[Course Schedule](https://leetcode.com/problems/course-schedule) | [Python](./python3/graph/courseSchedule.py)|Easy|
|417|[Pacific Atlantic Water Flow](https://leetcode.com/problems/pacific-atlantic-water-flow) | [Python](./python3/graph/pacificAtlantic.py)|Easy|
|200|[Number of Islands](https://leetcode.com/problems/number-of-islands) | [Python](./python3/graph/numberOfIslands.py)|Medium|
|128|[Longest Consecutive Sequence](https://leetcode.com/problems/longest-consecutive-sequence) | [Python](./python3/graph/longestConsecutiveSequence.py)|Medium|
|210|[Course Schedule II](https://leetcode.com/problems/course-schedule-ii) | [Python](./python3/graph/courseScheduleII.py)|Medium|
|797|[All Paths From Source to Target](https://leetcode.com/problems/all-paths-from-source-to-target) | [Python](./python3/graph/allPaths.py)|Medium|
|1557|[Minimum Number of Vertices to Reach All Nodes](https://leetcode.com/problems/minimum-number-of-vertices-to-reach-all-nodes) | [Python](./python3/graph/minNumberOfNodes.py)|Medium|
|2642|[Design Graph With Shortest Path Calculator](https://leetcode.com/problems/design-graph-with-shortest-path-calculator/) | [Python](./python3/graph/designGraph.py)|Hard|
|1470|[Shuffle the Array](https://leetcode.com/problems/shuffle-the-array) | [Python](./python3/array/shuffleTheArray.py)|Hard|
|1203|[Sort Items by Groups Respecting Dependencies](https://leetcode.com/problems/sort-items-by-groups-respecting-dependencies) | [Python](./python3/graph/sortItemsByGroups.py)|Hard|
|13|[Roman to Integer](https://leetcode.com/problems/roman-to-integer) | [Python](./python3/hash%20map/romanToInteger.py)|Easy|
|1290|[Convert Binary Number in a Linked List to Integer](https://leetcode.com/problems/convert-binary-number-in-a-linked-list-to-integer/) | [Python](./python3/linked%20list/convBinaryNum.py)|Easy|
|513|[Find Bottom Left Tree Value](https://leetcode.com/problems/find-bottom-left-tree-value) | [Python](./python3/tree/findBottomLeftTree.py)|Easy|
|1609|[Even Odd Tree](https://leetcode.com/problems/even-odd-tree) | [Python](./python3/tree/evenOddTree.py)|Medium|
|2864|[Maximum Odd Binary Number](https://leetcode.com/problems/maximum-odd-binary-number) | [Python](./python3/string/maxOddBinaryNumber.py)|Easy|
|977|[Squares of a Sorted Array](https://leetcode.com/problems/squares-of-a-sorted-array) | [Python](./python3/array/squaresOfArr.py)|Easy|
|19|[Remove Nth Node From End of List](https://leetcode.com/problems/remove-nth-node-from-end-of-list) | [Python](./python3/linked%20list/removeNthFromList.py)|Easy|
|876|[Middle of the Linked List](https://leetcode.com/problems/middle-of-the-linked-list) | [Python](./python3/linked%20list/middleOfTheLinkedList.py)|Easy|
|83|[Remove Duplicates from Sorted List](https://leetcode.com/problems/remove-duplicates-from-sorted-list) | [Python](./python3/linked%20list/removeDupelicatesFromList.py)|Easy|
|141|[Linked List Cycle](https://leetcode.com/problems/linked-list-cycle) | [Python](./python3/linked%20list/linkedListCycle.py)|Easy|
|3005|[Count Elements With Maximum Frequency](https://leetcode.com/problems/count-elements-with-maximum-frequency) | [Python](./python3/linked%20list/countElementsMaxFreq.py)|Easy|