Algorithm-Solutions-In-Swift
Algorithm-Solutions-In-Swift copied to clipboard
This repository contains 250+ data structures and algorithms solutions from AlgoExpert, LeetCode & HackerRank in Swift 🧑🏻💻
Algorithms Solutions in Swift
This repository contains solutions from AlgoExpert, LeetCode & HackerRank in Swift programming language.
Suggestions and contributions are welcome.
HackerRank
| Serial No. | Problem | Solution | Time Complexity | Space Complexity | Notes |
|---|---|---|---|---|---|
| 1 | 3D Surface Area | Link | _ | _ | _ |
| 2 | Almost Sorted | Link | _ | _ | _ |
| 3 | Binary Search Trees | Link | _ | _ | _ |
| 4 | Bitwise AND | Link | _ | _ | _ |
| 5 | Convert Decimal to Binary | Link | _ | _ | _ |
| 6 | Count Pairs | Link | _ | _ | _ |
| 7 | Encryption | Link | _ | _ | _ |
| 8 | Extra Long Factorials | Link | _ | _ | _ |
| 9 | Larry's Array | Link | _ | _ | _ |
| 10 | Merge Sort | Link | _ | _ | _ |
| 11 | Palindrome String | Link | _ | _ | _ |
| 12 | Reverse String | Link | _ | _ | _ |
| 13 | Sum of Natural Number | Link | _ | _ | _ |
| 14 | Tic Tac Toe Winner | Link | _ | _ | _ |
| 15 | Two Strings | Link | _ | _ | _ |
LeetCode
| Serial No. | Problem | Solution | Time Complexity | Space Complexity | Notes |
|---|---|---|---|---|---|
| 1 | 3 Sum Closest | Link | _ | _ | _ |
| 2 | Merge Intervals | Link | _ | _ | _ |
| 3 | Divide Two Integers | Link | _ | _ | _ |
| 4 | Single Number | Link | _ | _ | _ |
| 5 | Majority Element | Link | _ | _ | _ |
| 6 | Three Number Sum Zero | Link | _ | _ | _ |
| 7 | Binary Search | Link | _ | _ | _ |
| 8 | First Bad Version | Link | _ | _ | _ |
| 9 | Search Insert Position | Link | _ | _ | _ |
| 10 | Merge Intervals | Link | _ | _ | _ |
| 11 | Sort Colors | Link | _ | _ | _ |
| 12 | Design HashMap | Link | _ | _ | _ |
| 13 | Squares of a Sorted Array | Link | _ | _ | _ |
| 14 | Rotate Array | Link | _ | _ | _ |
| 15 | Move Zeros to End | Link | _ | _ | _ |
| 16 | Two Sum - Input Array Sorted | Link | _ | _ | _ |
| 17 | Pascal's Triangle - II | Link | _ | _ | _ |
| 18 | Rotate Image | Link | _ | _ | _ |
| 19 | Spiral Matix II | Link | _ | _ | _ |
| 20 | Reverse String | Link | _ | _ | _ |
| 21 | Reverse Words in a String | Link | _ | _ | _ |
| 22 | Search in a 2D Matrix | Link | _ | _ | _ |
| 23 | Erase Overlapping Intervals | Link | _ | _ | _ |
| 24 | Middle of the Linked List | Link | _ | _ | _ |
| 25 | Remove Nth Node from End of the Linked List | Link | _ | _ | _ |
| 26 | Longest Substring without Repeating Characters | Link | _ | _ | _ |
| 27 | Permutation in a String | Link | _ | _ | _ |
| 28 | Increasing Triplet Subsequence | Link | _ | _ | _ |
| 29 | Porduct of Array Except Self | Link | _ | _ | _ |
| 30 | Sub Array Sum Equals K | Link | _ | _ | _ |
| 31 | Add Strings | Link | _ | _ | _ |
| 32 | Longest Palindrome | Link | _ | _ | _ |
| 33 | Word Pattern | Link | _ | _ | _ |
| 34 | Partition Labels | Link | _ | _ | _ |
| 35 | Group Anagrams | Link | _ | _ | _ |
| 36 | Multiply Strings | Link | _ | _ | _ |
| 37 | Flood Fill | Link | _ | _ | _ |
| 38 | Max Area of Island | Link | _ | _ | _ |
| 39 | Merge Two Binary Trees | Link | _ | _ | _ |
| 40 | Populatng Next Right Pointer In Each Node | Link | _ | _ | _ |
| 41 | Three Sum Smaller | Link | _ | _ | _ |
| 42 | Spiral Matrix | Link | _ | _ | _ |
| 43 | Valid Parentheses | Link | _ | _ | _ |
| 44 | Best Time to Buy and Sell Stock | Link | _ | _ | _ |
| 45 | Longest Palindrome | Link | _ | _ | _ |
| 46 | Subsets | Link | _ | _ | _ |
| 47 | Convert Time with Minimum Operations | Link | _ | _ | _ |
| 48 | Find Players with Zero or One Loses | Link | _ | _ | _ |
| 49 | Largest Integer Digit Swap By Parity | Link | _ | _ | _ |
| 50 | Container with Most Water | Link | _ | _ | _ |
| 51 | License Key Formatting | Link | _ | _ | _ |
| 52 | Unique Email Addresses | Link | _ | _ | _ |
| 53 | Sort By Parity | Link | _ | _ | _ |
| 54 | Maximum Bags with Full Capacity of Rocks | Link | _ | _ | _ |
| 55 | Search 2D Matrix II | Link | _ | _ | _ |
| 56 | Remove Duplicates Sorted Array | Link | _ | _ | _ |
| 57 | Remove Element | Link | _ | _ | _ |
AlgoExpert
| Serial No. | Problem | Solution | Time Complexity | Space Complexity | Notes |
|---|---|---|---|---|---|
| 1 | Breadth First Search | Link | _ | _ | _ |
| 2 | Array of Products | Link | _ | _ | _ |
| 3 | Binary Search Tree Construction | Link | _ | _ | _ |
| 4 | Binary Search Tree Traversal | Link | _ | _ | _ |
| 5 | Binary Search | Link | _ | _ | _ |
| 6 | Binary Tree Diameter | Link | _ | _ | _ |
| 7 | Branch Sums | Link | _ | _ | _ |
| 8 | Bubble Sort | Link | _ | _ | _ |
| 9 | Caesar Cipher Encryptor | Link | _ | _ | _ |
| 10 | Class Photos | Link | _ | _ | _ |
| 11 | Depth First Search | Link | _ | _ | _ |
| 12 | Find Closest Value in Binary Search Tree | Link | _ | _ | _ |
| 13 | Find Loop in Linked List | Link | _ | _ | _ |
| 14 | Find Successor | Link | _ | _ | _ |
| 15 | Find Three Largest Numbers | Link | _ | _ | _ |
| 16 | First Duplicate Value | Link | _ | _ | _ |
| 17 | First Non-Repeating Character | Link | _ | _ | _ |
| 18 | Four Number Sum | Link | _ | _ | _ |
| 19 | Generate Document | Link | _ | _ | _ |
| 20 | Invert Binary Tree | Link | _ | _ | _ |
| 21 | Insertion Sort | Link | _ | _ | _ |
| 22 | Largest Range | Link | _ | _ | _ |
| 23 | Linked List Construction | Link | _ | _ | _ |
| 24 | Longest Palindromic Substring | Link | _ | _ | _ |
| 25 | Longest Peak | Link | _ | _ | _ |
| 26 | Max Subset Sum No Adjacent | Link | _ | _ | _ |
| 27 | Merge Linked Lists | Link | _ | _ | _ |
| 28 | Merge Overlapping Intervals | Link | _ | _ | _ |
| 29 | Merge Sort | Link | _ | _ | _ |
| 30 | Minimum Height Binary Search Tree | Link | _ | _ | _ |
| 31 | Minimum Waiting Time | Link | _ | _ | _ |
| 32 | Monotonic Array | Link | _ | _ | _ |
| 33 | Move Element To End | Link | _ | _ | _ |
| 34 | Node Depths | Link | _ | _ | _ |
| 35 | Non-Constructible Change | Link | _ | _ | _ |
| 36 | Nth Fibonacci Number | Link | _ | _ | _ |
| 37 | Palindrome Check | Link | _ | _ | _ |
| 38 | Prodcut Sum | Link | _ | _ | _ |
| 39 | Quick Sort | Link | _ | _ | _ |
| 40 | Remove Duplicates From Linked List | Link | _ | _ | _ |
| 41 | Remove kth Node From End | Link | _ | _ | _ |
| 42 | Reverse Linkedlist | Link | _ | _ | _ |
| 43 | Run Length Encoding | Link | _ | _ | _ |
| 44 | Search For Range | Link | _ | _ | _ |
| 45 | Search in Sorted Matrix | Link | _ | _ | _ |
| 46 | Selection Sort | Link | _ | _ | _ |
| 47 | Shifted Binary Search | Link | _ | _ | _ |
| 48 | Single Cycle Check | Link | _ | _ | _ |
| 49 | Smallest Difference | Link | _ | _ | _ |
| 50 | Sorted Squared Array | Link | _ | _ | _ |
| 51 | Spiral Traverse | Link | _ | _ | _ |
| 52 | Subarray Sort | Link | _ | _ | _ |
| 53 | Sum of Linkedlist | Link | _ | _ | _ |
| 54 | Tandem Bicycle | Link | _ | _ | _ |
| 55 | Three Number Sort | Link | _ | _ | _ |
| 56 | Three Number Sum | Link | _ | _ | _ |
| 57 | Tournament Winner | Link | _ | _ | _ |
| 58 | Two Number Sum | Link | _ | _ | _ |
| 59 | Validate Binary Search Tree | Link | _ | _ | _ |
| 60 | Validate Subsequence | Link | _ | _ | _ |
| 61 | ZigZag Traverse | Link | _ | _ | _ |
| 62 | Valid Starting City | Link | _ | _ | _ |
| 63 | Task Assignment | Link | _ | _ | _ |
| 64 | Min Rewards | Link | _ | _ | _ |
| 65 | Kadanes Algorithm | Link | _ | _ | _ |
| 66 | Calender Matching | Link | _ | _ | _ |
| 67 | Balanced Brackets | Link | _ | _ | _ |
| 68 | Apartment Hunting | Link | _ | _ | _ |
| 69 | Group Anagrams | Link | _ | _ | _ |
| 70 | Valid IP Addresses | Link | _ | _ | _ |
| 71 | Permutations | Link | _ | _ | _ |
| 72 | Power Sets | Link | _ | _ | _ |