This repository contains Swift solutions from AlgoExpert, LeetCode, HackerRank, GeekForGeeks, and Pramp.
Suggestions and contributions are welcome.
- Browse by platform section and open
Problem Linkfor the original prompt. - Open
Solutionto view the implementation in this repository. - Update
Difficulty,Topic/Pattern, orProblem Linkoverrides inscripts/readme-metadata.tsv. - Run
./scripts/update-readme.shto regenerate all tables (also runs automatically in pre-commit).
| Serial No. | Problem | Problem Link | Solution | Difficulty | Topic/Pattern | Notes |
|---|---|---|---|---|---|---|
| 1 | 3D Surface Area | Problem | Solution | _ | _ | _ |
| 2 | Almost Sorted | Problem | Solution | _ | Sorting | _ |
| 3 | Binary Search Trees | Problem | Solution | _ | Tree | _ |
| 4 | Bitwise AND | Problem | Solution | _ | _ | _ |
| 5 | Convert Decimal To Binary | Problem | Solution | _ | _ | _ |
| 6 | Count Pairs | Problem | Solution | _ | _ | _ |
| 7 | Encryption | Problem | Solution | _ | _ | _ |
| 8 | Extra Long Factorials | Problem | Solution | _ | _ | _ |
| 9 | Larry's Array | Problem | Solution | _ | Array | _ |
| 10 | Merge Sort | Problem | Solution | _ | Sorting | _ |
| 11 | Palindrome String | Problem | Solution | _ | String | _ |
| 12 | Reverse String | Problem | Solution | _ | String | _ |
| 13 | Sum of Natural Number | Problem | Solution | _ | Array | _ |
| 14 | Tic Tac Toe Winner | Problem | Solution | _ | _ | _ |
| 15 | Two Strings | Problem | Solution | _ | String | _ |
| Serial No. | Problem | Problem Link | Solution | Difficulty | Topic/Pattern | Notes |
|---|---|---|---|---|---|---|
| 1 | 3 Sum Closest | Problem | Solution | _ | Array | _ |
| 2 | Add Strings | Problem | Solution | _ | String | _ |
| 3 | Array Rotation | Problem | Solution | _ | Array | _ |
| 4 | Asteroid Collision | Problem | Solution | _ | _ | _ |
| 5 | Best Time to Buy and Sell Stock | Problem | Solution | _ | _ | _ |
| 6 | Binary Search | Problem | Solution | _ | Searching | _ |
| 7 | Bucket Sort | Problem | Solution | _ | Sorting | _ |
| 8 | Build a Matrix With Conditions | Problem | Solution | _ | Matrix | _ |
| 9 | Close Strings | Problem | Solution | _ | String | _ |
| 10 | Concatenation of Array | Problem | Solution | _ | Array | _ |
| 11 | Container With Most Water | Problem | Solution | _ | _ | _ |
| 12 | Contains Duplicate | Problem | Solution | _ | _ | _ |
| 13 | Convert Time Minimum Operations | Problem | Solution | _ | _ | _ |
| 14 | Delete Node in a Linked List | Problem | Solution | _ | Linked List | _ |
| 15 | Design HashMap | Problem | Solution | _ | _ | _ |
| 16 | Divide Two Integers | Problem | Solution | _ | _ | _ |
| 17 | Dota2 Senate | Problem | Solution | _ | _ | _ |
| 18 | Encode Decode Strings | Problem | Solution | _ | String | _ |
| 19 | Find All People With Secrets | Problem | Solution | _ | _ | _ |
| 20 | Find Players Zero or One Loses | Problem | Solution | _ | _ | _ |
| 21 | Find kth Largest Element | Problem | Solution | _ | _ | _ |
| 22 | Find the Index of the First Occurrence in a String | Problem | Solution | _ | String | _ |
| 23 | First Bad Version | Problem | Solution | _ | _ | _ |
| 24 | First Unique Character In String | Problem | Solution | _ | String | _ |
| 25 | Flood Fill | Problem | Solution | _ | _ | _ |
| 26 | Four Sum | Problem | Solution | _ | Array | _ |
| 27 | Group Anagrams | Problem | Solution | _ | String | _ |
| 28 | HashMap | Problem | Solution | _ | _ | _ |
| 29 | HashSet | Problem | Solution | _ | _ | _ |
| 30 | Increasing Triplet Subsequence | Problem | Solution | _ | _ | _ |
| 31 | Intersection of Two Array II | Problem | Solution | _ | Array | _ |
| 32 | Largest Integer Digit Swaps Parity | Problem | Solution | _ | _ | _ |
| 33 | License Key Formatting | Problem | Solution | _ | _ | _ |
| 34 | Linked List Cycle | Problem | Solution | _ | Linked List | _ |
| 35 | Longest Common Prefix | Problem | Solution | _ | _ | _ |
| 36 | Longest Consecutive Sequence | Problem | Solution | _ | _ | _ |
| 37 | Longest Palindrome | Problem | Solution | _ | String | _ |
| 38 | Longest Substring without Repeating Characters | Problem | Solution | _ | Tree | _ |
| 39 | Majority Element | Problem | Solution | _ | _ | _ |
| 40 | Max Area of Island | Problem | Solution | _ | Matrix | _ |
| 41 | Max Number of Vowels | Problem | Solution | _ | _ | _ |
| 42 | Maximum Bags with Full Capacity of Rocks | Problem | Solution | _ | _ | _ |
| 43 | Maximum Depth of a Binary Tree | Problem | Solution | _ | Tree | _ |
| 44 | Maximum Score From Removing Substrings | Problem | Solution | _ | Tree | _ |
| 45 | Merge Intervals | Problem | Solution | _ | _ | _ |
| 46 | Merge Strings Alternatively | Problem | Solution | _ | String | _ |
| 47 | Merge Two Binary Trees | Problem | Solution | _ | Tree | _ |
| 48 | MergeIntervals | Problem | Solution | _ | _ | _ |
| 49 | MergeKLists | Problem | Solution | _ | _ | _ |
| 50 | Middle of the Linked List | Problem | Solution | _ | Linked List | _ |
| 51 | Min Stack | Problem | Solution | _ | Stack / Queue | _ |
| 52 | Minimum Window Substring | Problem | Solution | _ | Tree | _ |
| 53 | Move Zeros to End | Problem | Solution | _ | _ | _ |
| 54 | Multiply Strings | Problem | Solution | _ | String | _ |
| 55 | Non-Overlapping Intervals | Problem | Solution | _ | _ | _ |
| 56 | Palindrome Linked List | Problem | Solution | _ | Linked List | _ |
| 57 | Partition Labels | Problem | Solution | _ | _ | _ |
| 58 | Pascal's Triangle II | Problem | Solution | _ | _ | _ |
| 59 | Permutation in String | Problem | Solution | _ | String | _ |
| 60 | Plus One | Problem | Solution | _ | _ | _ |
| 61 | Populating Next Right Pointer in Each Node | Problem | Solution | _ | _ | _ |
| 62 | Product of Array Except Self | Problem | Solution | _ | Array | _ |
| 63 | Randomized Set | Problem | Solution | _ | _ | _ |
| 64 | Recursive Bubble Sort | Problem | Solution | _ | Sorting | _ |
| 65 | Recursive Insertion Sort | Problem | Solution | _ | Sorting | _ |
| 66 | Remove Duplicates Sorted Array | Problem | Solution | _ | Sorting | _ |
| 67 | Remove Element | Problem | Solution | _ | _ | _ |
| 68 | Remove Nth Node From End of List | Problem | Solution | _ | _ | _ |
| 69 | Remove Nth Node from Linked List | Problem | Solution | _ | Linked List | _ |
| 70 | Reverse Integer | Problem | Solution | _ | _ | _ |
| 71 | Reverse Linked Lists | Problem | Solution | _ | Linked List | _ |
| 72 | Reverse String | Problem | Solution | _ | String | _ |
| 73 | Reverse Words in a String | Problem | Solution | _ | String | _ |
| 74 | Rotate Array | Problem | Solution | _ | Array | _ |
| 75 | Rotate Image | Problem | Solution | _ | _ | _ |
| 76 | Running Sum 1D Array | Problem | Solution | _ | Array | _ |
| 77 | Search 2D Matrix | Problem | Solution | _ | Matrix | _ |
| 78 | Search Insert Position | Problem | Solution | _ | Searching | _ |
| 79 | Search a 2D Matrix II | Problem | Solution | _ | Matrix | _ |
| 80 | Set Zeros Matrix | Problem | Solution | _ | Matrix | _ |
| 81 | Single Number | Problem | Solution | _ | _ | _ |
| 82 | Sort An Array | Problem | Solution | _ | Sorting | _ |
| 83 | Sort Colors | Problem | Solution | _ | Sorting | _ |
| 84 | Sort by Parity | Problem | Solution | _ | Sorting | _ |
| 85 | Sorted and Rotated Array | Problem | Solution | _ | Sorting | _ |
| 86 | Spiral Matrix II | Problem | Solution | _ | Matrix | _ |
| 87 | Sprial Matrix | Problem | Solution | _ | Matrix | _ |
| 88 | Squares of a Sorted Array | Problem | Solution | _ | Sorting | _ |
| 89 | String to Integer(atoi) | Problem | Solution | _ | String | _ |
| 90 | Strings Multiply | Problem | Solution | _ | String | _ |
| 91 | Sub Array Sum Equals K | Problem | Solution | _ | Array | _ |
| 92 | Subsets | Problem | Solution | _ | _ | _ |
| 93 | Symmetric Tree | Problem | Solution | _ | Tree | _ |
| 94 | Three Sum Smaller | Problem | Solution | _ | Array | _ |
| 95 | Three Sum Zero | Problem | Solution | _ | Array | _ |
| 96 | Top K Frequent Elements | Problem | Solution | _ | _ | _ |
| 97 | Topological Sort | Problem | Solution | _ | Graph | _ |
| 98 | Two Number Sum - Sorted Input Array | Problem | Solution | _ | Sorting | _ |
| 99 | Unique Binary Search Tree 2 | Problem | Solution | _ | Tree | _ |
| 100 | Unique Email Address | Problem | Solution | _ | _ | _ |
| 101 | Valid Anagram | Problem | Solution | _ | String | _ |
| 102 | Valid Palindrome 2 | Problem | Solution | _ | String | _ |
| 103 | Valid Parantheses | Problem | Solution | _ | _ | _ |
| 104 | Valid Parentheses | Problem | Solution | _ | _ | _ |
| 105 | Valid Suduku | Problem | Solution | _ | _ | _ |
| 106 | Word Pattern | Problem | Solution | _ | String | _ |
| Serial No. | Problem | Problem Link | Solution | Difficulty | Topic/Pattern | Notes |
|---|---|---|---|---|---|---|
| 1 | Apartment Hunting | _ | Solution | _ | _ | _ |
| 2 | Array of Products | _ | Solution | _ | Array | _ |
| 3 | BST Construction | _ | Solution | _ | Tree | _ |
| 4 | BST Traversal | _ | Solution | _ | Tree | _ |
| 5 | Balanced Brackets | _ | Solution | _ | _ | _ |
| 6 | Binary Search | _ | Solution | _ | Searching | _ |
| 7 | Binary Tree Diameter | _ | Solution | _ | Tree | _ |
| 8 | Branch Sums | _ | Solution | _ | Array | _ |
| 9 | Breadth First Search | _ | Solution | _ | Searching | _ |
| 10 | Bubble Sort | _ | Solution | _ | Sorting | _ |
| 11 | Caesar Cipher Encryptor | _ | Solution | _ | _ | _ |
| 12 | Calender Matching | _ | Solution | _ | _ | _ |
| 13 | Class Photos | _ | Solution | _ | _ | _ |
| 14 | Depth First Search | _ | Solution | _ | Searching | _ |
| 15 | Find Closest Value In BST | _ | Solution | _ | Tree | _ |
| 16 | Find Kth Largest Node in BST | _ | Solution | _ | Tree | _ |
| 17 | Find Loop in Linked List | _ | Solution | _ | Linked List | _ |
| 18 | Find Nodes Distance K | _ | Solution | _ | _ | _ |
| 19 | Find Successor | _ | Solution | _ | _ | _ |
| 20 | Find Three Largest Numbers | _ | Solution | _ | _ | _ |
| 21 | First Duplicate Value | _ | Solution | _ | _ | _ |
| 22 | First Non Repeating Character | _ | Solution | _ | _ | _ |
| 23 | Four Number Sum | _ | Solution | _ | Array | _ |
| 24 | Generate Document | _ | Solution | _ | _ | _ |
| 25 | Group Anagrams | _ | Solution | _ | String | _ |
| 26 | Height Balanced Binary Tree | _ | Solution | _ | Tree | _ |
| 27 | Insertion Sort | _ | Solution | _ | Sorting | _ |
| 28 | Invert Binary Tree | _ | Solution | _ | Tree | _ |
| 29 | Kadanes Algorithm | _ | Solution | _ | _ | _ |
| 30 | LRU Cache | _ | Solution | _ | _ | _ |
| 31 | Largest Range | _ | Solution | _ | _ | _ |
| 32 | Levenshtein Distance | _ | Solution | _ | _ | _ |
| 33 | Linked List Construction | _ | Solution | _ | Linked List | _ |
| 34 | Longest Common Subsequence | _ | Solution | _ | _ | _ |
| 35 | Longest Palindromic Substring | _ | Solution | _ | Tree | _ |
| 36 | Longest Peak | _ | Solution | _ | _ | _ |
| 37 | Longest Substring Without Duplication | _ | Solution | _ | Tree | _ |
| 38 | Lowest Common Manager | _ | Solution | _ | _ | _ |
| 39 | Max Path Sum | _ | Solution | _ | Array | _ |
| 40 | Max Subset Sum No Adjacent | _ | Solution | _ | Array | _ |
| 41 | Max Sum Increasing Subsequence | _ | Solution | _ | Array | _ |
| 42 | Merge LinkedLists | _ | Solution | _ | _ | _ |
| 43 | Merge Overlapping Intervals | _ | Solution | _ | _ | _ |
| 44 | Merge Sort | _ | Solution | _ | Sorting | _ |
| 45 | Min Height BST | _ | Solution | _ | Tree | _ |
| 46 | Min Max Stack Construction | _ | Solution | _ | Stack / Queue | _ |
| 47 | Min Number of Jumps | _ | Solution | _ | _ | _ |
| 48 | Min Rewards | _ | Solution | _ | _ | _ |
| 49 | Minimum Waiting Time | _ | Solution | _ | _ | _ |
| 50 | Monotonic Array | _ | Solution | _ | Array | _ |
| 51 | Move Element to End | _ | Solution | _ | _ | _ |
| 52 | Next Greater Element | _ | Solution | _ | _ | _ |
| 53 | Node Depths | _ | Solution | _ | _ | _ |
| 54 | Non-Constructible Change | _ | Solution | _ | _ | _ |
| 55 | Nth Fibonacci | _ | Solution | _ | _ | _ |
| 56 | Number of Ways To Traverse Graph | _ | Solution | _ | Graph | _ |
| 57 | Number of Ways to Make Change | _ | Solution | _ | _ | _ |
| 58 | Palindrome Check | _ | Solution | _ | String | _ |
| 59 | Permutations | _ | Solution | _ | _ | _ |
| 60 | Power Set | _ | Solution | _ | _ | _ |
| 61 | Product Sum | _ | Solution | _ | Array | _ |
| 62 | Quick Sort | _ | Solution | _ | Sorting | _ |
| 63 | Reconstruct BST | _ | Solution | _ | Tree | _ |
| 64 | Remove Duplicates From Linked List | _ | Solution | _ | Linked List | _ |
| 65 | Remove Islands | _ | Solution | _ | Matrix | _ |
| 66 | Remove Kth Node From End | _ | Solution | _ | _ | _ |
| 67 | Reverse Linkedlist | _ | Solution | _ | _ | _ |
| 68 | Right Smaller Than | _ | Solution | _ | _ | _ |
| 69 | River Sizes | _ | Solution | _ | _ | _ |
| 70 | Run Length Encoding | _ | Solution | _ | _ | _ |
| 71 | Same BSTs | _ | Solution | _ | Tree | _ |
| 72 | Search For Range | _ | Solution | _ | Searching | _ |
| 73 | Search In Sorted Matrix | _ | Solution | _ | Matrix | _ |
| 74 | Selection Sort | _ | Solution | _ | Sorting | _ |
| 75 | Shift Linked List | _ | Solution | _ | Linked List | _ |
| 76 | Shifted Binary Search | _ | Solution | _ | Searching | _ |
| 77 | Single Cycle Check | _ | Solution | _ | _ | _ |
| 78 | Smallest Difference | _ | Solution | _ | _ | _ |
| 79 | Sort Stacks | _ | Solution | _ | Sorting | _ |
| 80 | Sorted Squared Array | _ | Solution | _ | Sorting | _ |
| 81 | Spiral Traverse | _ | Solution | _ | Matrix | _ |
| 82 | Staircase Traversal | _ | Solution | _ | _ | _ |
| 83 | Subarray Sort | _ | Solution | _ | Sorting | _ |
| 84 | Sum of Linked List | _ | Solution | _ | Linked List | _ |
| 85 | Sunset Views | _ | Solution | _ | _ | _ |
| 86 | Tandem Bicycle | _ | Solution | _ | _ | _ |
| 87 | Task Assignment | _ | Solution | _ | _ | _ |
| 88 | Three Number Sort | _ | Solution | _ | Sorting | _ |
| 89 | Three Number Sum | _ | Solution | _ | Array | _ |
| 90 | Tournament Winner | _ | Solution | _ | _ | _ |
| 91 | Two Number Sum | _ | Solution | _ | Array | _ |
| 92 | Valid IP Addresses | _ | Solution | _ | _ | _ |
| 93 | Valid Starting City | _ | Solution | _ | _ | _ |
| 94 | Validate BST | _ | Solution | _ | Tree | _ |
| 95 | Validate Subsequence | _ | Solution | _ | _ | _ |
| 96 | Validate Three Nodes | _ | Solution | _ | _ | _ |
| 97 | Water Area | _ | Solution | _ | _ | _ |
| 98 | Youngest Common Ancestor | _ | Solution | _ | _ | _ |
| 99 | ZigZag Traverse | _ | Solution | _ | _ | _ |
| Serial No. | Problem | Problem Link | Solution | Difficulty | Topic/Pattern | Notes |
|---|---|---|---|---|---|---|
| 1 | Nth Root of A Number | Problem | Solution | _ | _ | _ |
| Serial No. | Problem | Problem Link | Solution | Difficulty | Topic/Pattern | Notes |
|---|---|---|---|---|---|---|
| 1 | Nth Root of Number | Problem | Solution | _ | _ | _ |
| 2 | Smallest Substring of All Characters | Problem | Solution | _ | Tree | _ |
This README is generated from the repository directory structure.