Skip to content

boudhayan/Algorithm-Solutions-In-Swift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

371 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Algorithms Solutions in Swift

This repository contains Swift solutions from AlgoExpert, LeetCode, HackerRank, GeekForGeeks, and Pramp.

Suggestions and contributions are welcome.

How to Use

  • Browse by platform section and open Problem Link for the original prompt.
  • Open Solution to view the implementation in this repository.
  • Update Difficulty, Topic/Pattern, or Problem Link overrides in scripts/readme-metadata.tsv.
  • Run ./scripts/update-readme.sh to 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 Digits Problem Solution _ _ _
3 Add Strings Problem Solution _ String _
4 Array Intersection Problem Solution _ Array _
5 Array Pair Sum Problem Solution _ Array _
6 Array Rotation Problem Solution _ Array _
7 Asteroid Collision Problem Solution _ _ _
8 Best Time to Buy and Sell Stock Problem Solution _ _ _
9 Binary Search Problem Solution _ Searching _
10 Bucket Sort Problem Solution _ Sorting _
11 Build a Matrix With Conditions Problem Solution _ Matrix _
12 Can Construct Problem Solution _ _ _
13 Can Make Arithmetic Progression Problem Solution _ _ _
14 Candy Swap Problem Solution _ _ _
15 Close Strings Problem Solution _ String _
16 Concatenation of Array Problem Solution _ Array _
17 Confusing Number Problem Solution _ _ _
18 Container With Most Water Problem Solution _ _ _
19 Contains Duplicate Problem Solution _ _ _
20 Convert Time Minimum Operations Problem Solution _ _ _
21 Count And Say Problem Solution _ _ _
22 Count Negatives Problem Solution _ _ _
23 Count Pairs Problem Solution _ _ _
24 Delete Node in a Linked List Problem Solution _ Linked List _
25 Design HashMap Problem Solution _ _ _
26 Divide Two Integers Problem Solution _ _ _
27 Dota2 Senate Problem Solution _ _ _
28 Encode Decode Strings Problem Solution _ String _
29 Find All People With Secrets Problem Solution _ _ _
30 Find Differences String Problem Solution _ String _
31 Find Peak Element Problem Solution _ _ _
32 Find Players Zero or One Loses Problem Solution _ _ _
33 Find kth Largest Element Problem Solution _ _ _
34 Find the Index of the First Occurrence in a String Problem Solution _ String _
35 First Bad Version Problem Solution _ _ _
36 First Unique Character In String Problem Solution _ String _
37 Fixed Point Problem Solution _ _ _
38 Flood Fill Problem Solution _ _ _
39 Four Sum Problem Solution _ Array _
40 Group Anagrams Problem Solution _ String _
41 HashMap Problem Solution _ _ _
42 HashSet Problem Solution _ _ _
43 Increasing Triplet Subsequence Problem Solution _ _ _
44 Intersection of Two Array II Problem Solution _ Array _
45 Is Alien Sorted Problem Solution _ Sorting _
46 Is Majority Element Problem Solution _ _ _
47 Largest Integer Digit Swaps Parity Problem Solution _ _ _
48 Largest Triangle Area Problem Solution _ _ _
49 License Key Formatting Problem Solution _ _ _
50 Linked List Cycle Problem Solution _ Linked List _
51 Longest Common Prefix Problem Solution _ _ _
52 Longest Consecutive Sequence Problem Solution _ _ _
53 Longest Palindrome Problem Solution _ String _
54 Longest Substring without Repeating Characters Problem Solution _ Tree _
55 Majority Element Problem Solution _ _ _
56 Majority Element 2 Problem Solution _ _ _
57 Max Area of Island Problem Solution _ Matrix _
58 Max Distance Problem Solution _ _ _
59 Max Number of Vowels Problem Solution _ _ _
60 Maximum Bags with Full Capacity of Rocks Problem Solution _ _ _
61 Maximum Count Problem Solution _ _ _
62 Maximum Depth of a Binary Tree Problem Solution _ Tree _
63 Maximum Score From Removing Substrings Problem Solution _ Tree _
64 Merge In Place Problem Solution _ _ _
65 Merge Intervals Problem Solution _ _ _
66 Merge Strings Alternatively Problem Solution _ String _
67 Merge Two Binary Trees Problem Solution _ Tree _
68 MergeIntervals Problem Solution _ _ _
69 MergeKLists Problem Solution _ _ _
70 Message Logger Problem Solution _ _ _
71 Middle of the Linked List Problem Solution _ Linked List _
72 Min Stack Problem Solution _ Stack / Queue _
73 Minimum Window Substring Problem Solution _ Tree _
74 Missing Ranges Problem Solution _ _ _
75 Move Zeros to End Problem Solution _ _ _
76 Multiply Strings Problem Solution _ String _
77 Next Permutation Problem Solution _ _ _
78 Non-Overlapping Intervals Problem Solution _ _ _
79 Palindrome Linked List Problem Solution _ Linked List _
80 Partition Labels Problem Solution _ _ _
81 Pascal's Triangle II Problem Solution _ _ _
82 Permutation in String Problem Solution _ String _
83 Plus One Problem Solution _ _ _
84 Populating Next Right Pointer in Each Node Problem Solution _ _ _
85 Product of Array Except Self Problem Solution _ Array _
86 Randomized Set Problem Solution _ _ _
87 Recursive Bubble Sort Problem Solution _ Sorting _
88 Recursive Insertion Sort Problem Solution _ Sorting _
89 Remove Duplicates Sorted Array Problem Solution _ Sorting _
90 Remove Element Problem Solution _ _ _
91 Remove Nth Node From End of List Problem Solution _ _ _
92 Remove Nth Node from Linked List Problem Solution _ Linked List _
93 Reverse Integer Problem Solution _ _ _
94 Reverse Linked Lists Problem Solution _ Linked List _
95 Reverse Pairs Problem Solution _ _ _
96 Reverse String Problem Solution _ String _
97 Reverse Words in a String Problem Solution _ String _
98 Rotate Array Problem Solution _ Array _
99 Rotate Image Problem Solution _ _ _
100 Running Sum 1D Array Problem Solution _ Array _
101 Search 2D Matrix Problem Solution _ Matrix _
102 Search Insert Position Problem Solution _ Searching _
103 Search a 2D Matrix II Problem Solution _ Matrix _
104 Set Zeros Matrix Problem Solution _ Matrix _
105 Shortest Distance Problem Solution _ _ _
106 Single Number Problem Solution _ _ _
107 Sort An Array Problem Solution _ Sorting _
108 Sort Array By Parity II Problem Solution _ Sorting _
109 Sort Colors Problem Solution _ Sorting _
110 Sort by Parity Problem Solution _ Sorting _
111 Sorted and Rotated Array Problem Solution _ Sorting _
112 Spiral Matrix II Problem Solution _ Matrix _
113 Sprial Matrix Problem Solution _ Matrix _
114 Squares of a Sorted Array Problem Solution _ Sorting _
115 String to Integer(atoi) Problem Solution _ String _
116 Strings Multiply Problem Solution _ String _
117 Sub Array Sum Equals K Problem Solution _ Array _
118 Subsets Problem Solution _ _ _
119 Symmetric Tree Problem Solution _ Tree _
120 Target Indicies Problem Solution _ _ _
121 Three Parts Equal Sum Problem Solution _ Array _
122 Three Sum Smaller Problem Solution _ Array _
123 Three Sum Zero Problem Solution _ Array _
124 Top K Frequent Elements Problem Solution _ _ _
125 Topological Sort Problem Solution _ Graph _
126 Two Number Sum - Sorted Input Array Problem Solution _ Sorting _
127 Two Sum Less Than K Problem Solution _ Array _
128 Ugly Number Problem Solution _ _ _
129 Unique Binary Search Tree 2 Problem Solution _ Tree _
130 Unique Email Address Problem Solution _ _ _
131 Valid Anagram Problem Solution _ String _
132 Valid Palindrome 2 Problem Solution _ String _
133 Valid Parantheses Problem Solution _ _ _
134 Valid Parentheses Problem Solution _ _ _
135 Valid Suduku Problem Solution _ _ _
136 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 _

Maintenance

This README is generated from the repository directory structure.

Releases

No releases published

Packages

 
 
 

Contributors