Skip to content

jshivam/DSA-Swift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 

Repository files navigation

DSA-Swift

Data Structures and Algorithms in Swift

Note: Most of problems have been picked from leetcode.

Language

  • Swift 5.0

Data Structure

Tree

  1. Diameter of Binary Tree
  2. Invert Binary Tree
  3. Kth Smallest Element in a BST
  4. LCA of a Binary Tree
  5. Level Order Traversal
  6. Maximum Depth of Binary Tree
  7. Maximum Path Sum
  8. MinimunDepth
  9. Shortest distance between two nodes in BST
  10. Validate Binary Search Tree
  11. VerticalOrderTraversal
  12. Sum Tree
  13. Binary Tree Paths
  14. Recover Binary Search Tree
  15. LCA of a BST
  16. Unique Binary Search Trees
  17. Convert Sorted Array to Binary Search Tree
  18. Construct Binary Tree from Preorder and Inorder Traversal
  19. Boundary Traversal Of Binary Tree

Array

  1. Binary Search
  2. Jump Game
  3. Kth Largest Element
  4. Subarray Sum Equals K
  5. Subsets
  6. Minimum Window Substring
  7. Sort Colors
  8. Frequencies of array elements in range 1 to n
  9. Delete Products
  10. K-diff Pairs in an Array
  11. Maximum Product Sum Among All Rotations
  12. Minimum Swaps To Sort An Array
  13. Two Sum
  14. Longest Common Prefix
  15. Group Anagrams
  16. Maximum Subarray
  17. Longest Consecutive Sequence
  18. Merge Intervals
  19. Find Peak Element
  20. SmallestPositiveInteger
  21. Gas Station
  22. 3Sum Smaller
  23. Minimum Remove to Make Valid Parentheses
  24. Search in Rotated Sorted Array
  25. Minimum Subarray With Required Sum
  26. Longest Substring Of All Vowels in Order

Cache

  1. LRUCache
  2. Insert Delete GetRandom in O(1)

Dynamic Programming

  1. Partition Equal Subset Sum
  2. Maximum Sum Subsequence NonAdjacent
  3. Coin Change
  4. Climbing Stairs
  5. Best Time to Buy and Sell Stock
  6. House Robber
  7. Edit Distance
  8. Longest Increasing Subsequence
  9. Longest Common Subsequence

Graph

  1. WordLadder

Backtracking

  1. Permutations
  2. Generate Parentheses

LinkList

  1. LinkList
  2. Reorder List

Math

  1. Count Primes
  2. Palindrome Number
  3. Power
  4. Valid Number
  5. Square Root of Number

Matrix

  1. Diagonal Traverse
  2. Spiral Matrix
  3. Set Matrix Zeroes
  4. Search a 2D Matrix II
  5. Number of Islands
  6. Unique Paths

Queue

  1. Queue

Stack

  1. Valid Parentheses

Sorting

  1. QuickSort
  2. MergeSort

Heap

  1. Heap

Tri

  1. Tri