Skip to content

✨ a bunch of algorithms in a bunch of languages ✨

Notifications You must be signed in to change notification settings

pankajkompella/Algorithms

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🆘 Algorithms 🆘

  • A lot of leetcode problems with their most optimal solutions explained in detail!
    • The order questions are listed in is on purpose and is recommended to follow
    • HitCount

📚Arrays

Title Recommended Order # Leetcode # Difficulty Tags Solution
Plus One 1 66 Easy Array Python / Go / Dart / Rust / Javascript
Two Sum 2 1 Easy Array, Hash Map Python / Go / Kotlin / Dart / Rust / Javascript
Valid Parentheses 3 20 Easy Array, Stack Python / Go
Maximum Subarray 4 53 Easy Array Python / Go / Dart
First Unique Character in a String 5 387 Easy Array, Hash Map Python / Go / Javascript / Dart
Move Zeroes 6 283 Easy Array, Pointer Python / Go
Find Pivot Index 7 724 Easy Array, Sliding Window Python / Go / Kotlin
Best Time to Buy and Sell Stock 8 122 Easy Array Python
Shortest Word Distance 9 243 Easy Array Python
ZigZag Conversion 10 6 Medium Array Python
First Missing Positive 11 41 Hard Array Python
Spiral Matrix 12 54 Medium Array Python
Sorted Two Sum 13 167 Easy Array Python
K-diff Pairs in an Array 14 532 Easy Array, Hash Map Python
K Difference Uniqie Pairs 15 - Easy Array Python
Increasing Triplet Subsequence 16 334 Medium Array Python
Find First and Last Position of Element in Sorted Array 17 34 Medium Array, Binary Search Python
Merge Intervals 18 56 Easy Array Python
Valid Sudoku 19 36 Medium Array, Hash Map Python
Three Sum 20 - Medium Array, Two Sum Python
Maximum Size Subarray Sum Equals K 21 325 Medium Array, Two Sum Python
Product of Array Except Self 22 238 Medium Array Python
Trapping Rain Water 23 42 Hard Array, Two Pointer Python
Longest Consecutive Sequence 24 128 Hard Array Python
Top K Frequent Elements 25 347 Medium Array, Counting Sort, Hashmap, Heap Python

🧵 Strings

Title Leetcode # Difficulty Tags Solution
First Unique Character in a String 387 Easy String, Hash Map Python / Javascript / Dart
Reverse Words in String 344 Easy String Python
Reverse Words in String II 557 Easy String Python
Strobogrammatic Number 246 Easy String Python
Valid Anagram 242 Easy Hash Map Python
Compare Version Number 165 Easy String Python
String To Integer 8 Medium String Python
One Edit Distance 161 Medium String, Dynamic Programming Python
Add Binary 67 Easy String, Recursion Python
Longest Palindromic Substring 5 Medium String Python
Longest Substring Without Repeating Characters 3 Medium String Python
Text Justification 68 Hard String, Scheduling Python
Minimum Window Substring 76 Hard String, Sliding Window Python

🌲 Trees

Title Recommended Order # Leetcode # Difficulty Tags Solution
Binary Tree Inorder Traversal 1 94 Easy Tree, Recursive, Iterative Python
Insert into a Binary Search Tree 2 - Easy Tree Python
Preorder Traversal 3 - Easy Tree traversal Python
Postorder Traversal 3 - Medium Tree traversal Python
Inorder Successor 4 285 Medium Tree traversal Python
Closest Binary Search Tree Value 5 Easy 270 BST Search Python
Binary Tree Level Order Traversal 6 102 Medium BFS Python
Validate Binary Search Tree 7 98 Medium DFS, Recursion Python
Same Tree 9 100 Easy Recursion Python
Invert Binary Tree 10 226 Easy Recursion Python
Symmetric Tree 11 101 Easy Tree Python
Univalued Binary Tree 12 965 Easy Tree Python
Kth Smallest Element in a BST 13 230 Medium Tree Python
Path Sum 14 112 Easy DFS, Recursion Python
Minimum Depth of Binary Tree 15 111 Easy Tree Python
Sum Root to Leaf Numbers 16 129 Medium DFS, Recursion Python
Flatten Binary Tree to Linked List 17 114 Medium Recursion Python
Convert BST to Greater Tree 18 538 Easy BFS Python
Binary Tree Zigzag Level Order Traversal 19 103 Medium BFS Python
Populating Next Right Pointers in Each Node 20 116 Medium BFS Python
Binary Tree Maximum Path Sum 21 124 Hard DFS, Recursion Python
Delete Nodes And Return Forest 22 1110 Medium DFS, Recursion Python
Binary Search Tree to Greater Sum Tree 23 1038 Medium In Order Python

🔗 Linked Lists

Title Recommended Order # Leetcode # Difficulty Tags Solution
Reverse Linked List 1 206 Easy Linked List Python
Merge Linked List 2 - Easy Linked List, Recursion Python
Add Two Numbers 3 2 Medium Linked List Python
Delete Node From Linked List 4 237 Easy Linked List Python
Merge k Sorted Lists 5 23 Hard Linked List, Heap Python

🥞 Stack

Title Recommended Order # Leetcode # Difficulty Tags Solution
Decode String 1 394 Medium Stack Python

⚖️ Heaps

Title Recommended Order # Leetcode # Difficulty Tags Solution
Meeting Rooms II 1 253 Medium Heap Python

💯 Bitwise

Title Leetcode # Difficulty Tags Solution
Number of 1 Bits 191 Easy Bitwise Python / C
Hamming Distance 461 Easy Bitwise Python
Single Number 91 Easy Bitwise Python

📈 Graph

Title Recommended Order # Leetcode # Difficulty Tags Solution
Number Of Islands 1 200 Medium Depth First Search Python / C
Flood Fill 2 733 Easy Depth First Search Python
Graph Valid Tree 3 261 Easy Graph Python
Number of Connected Components in an Undirected Graph 4 323 Medium Depth First Search Python
Topological Sort 5 - Medium Graph Python
Validate DAG 6 - Medium Graph Python
Redundant Connection 7 684 Medium Graph Python
Course Schedule 8 207 Medium Top Sort Python
Course Schedule II 9 210 Medium Top Sort Python

🗃️ Sorting

Title Leetcode # Difficulty Tags Solution
Merge Sort - Easy Sorting, Recursion Python

🔍Searching

Title Recommended Order # Leetcode # Difficulty Tags Solution
Find First and Last Position of Element in Sorted Array 1 34 Medium Binary Search Python
Search in Rotated Sorted Array 2 33 Medium Binary Search Python

⚒️ Divide and Conquer

Title Recommended Order # Leetcode # Difficulty Tags Solution
Pow(x, n) 1 50 Medium Divide and Conquer, Recursion Python
Number of Inversions - - Medium Divide and Conquer Python
Majority Element - - Medium Divide and Conquer Python

🤖 Dynamic Programming

Title Recommended Order # Leetcode # Difficulty Tags Solution
Climbing Stairs 1 70 Easy Dynamic Programming Python
Coin Change 2 2 518 Medium Dynamic Programming Python
Decode Ways 3 91 Medium Dynamic Programming, Top Down Python
Unique Paths 4 62 Medium Dynamic Programming, Top Down Python
Delete Operation for Two Strings 5 583 Medium Dynamic Programming Python
Edit Distance 6 72 Hard Dynamic Programming, Top Down Python
Longest Common Subsequence 7 1143 Hard Dynamic Programming, Bottom Up Python
Maximum Length of Repeated Subarray 8 718 Medium Dynamic Programming, Bottom Up, Longest Common Subarray Python

🎨 Design

Title Recommended Order # Leetcode # Difficulty Tags Solution
LRU Cache 1 146 Medium Linked List, Hashmap Python

About

✨ a bunch of algorithms in a bunch of languages ✨

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 85.3%
  • Dart 5.0%
  • JavaScript 3.0%
  • Kotlin 2.1%
  • Go 1.4%
  • C 1.3%
  • Other 1.9%