Skip to content

Keshavkumar96/DSA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

18 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“š Data Structures & Algorithms in Swift

A growing collection of Data Structures & LeetCode-style DSA solutions implemented in Swift ๐Ÿš€

Welcome to my DSA in Swift repository!

This repo is my personal journey (and a helpful reference for others) to master Data Structures and Algorithms โ€” all implemented in Swift ๐Ÿ’ป

Here, youโ€™ll find clean, well-documented solutions to popular problems from LeetCode โ€” neatly organized by data structure and algorithm type.

๐Ÿ’ก Objective

This repository documents my journey to master Data Structures & Algorithms using Swift, by solving real interview-standard problems and organizing them by topic.

Perfect for:

  • โœ… iOS Engineers prepping for interviews
  • โœ… Swift learners who want DSA fundamentals
  • โœ… Anyone who wants clean, readable Swift solutions

๐Ÿš€ Goals

  • ๐Ÿ“˜ Strengthen understanding of core data structures and algorithms
  • ๐Ÿงฉ Solve LeetCode problems in Swift
  • ๐Ÿ—‚๏ธ Organize them by category for easy navigation
  • ๐Ÿง  Write clean, readable, and efficient Swift code
  • ๐Ÿ’ฌ Optionally include explanations & time complexities

๐Ÿ“š Repository Structure

Each directory represents a Data Structure or Algorithm Category.
Within each folder, youโ€™ll find problems with their Swift implementations and clear explanations (where applicable).

๐Ÿ“ฆ Folder ๐Ÿงฉ Description
๐Ÿงฎ Arrays Problems involving arrays, searching, sorting, and manipulation
๐Ÿ”— LinkedList Linked list operations โ€“ reversing, merging, detecting cycles
๐Ÿงฑ Stack Stack-based problems (e.g. parentheses, next greater element)
๐ŸŒ€ Queue FIFO structures, sliding window, and scheduling problems
๐Ÿ” Hashing HashMap / Dictionary based problems
๐ŸŒณ Trees Binary Trees, BSTs, traversals, depth/height problems
๐ŸŒ Graphs BFS, DFS, pathfinding, connected components
๐Ÿง  DynamicProgramming Classic DP problems like LIS, LCS, Knapsack

Each folder includes:

  • โœ… Swift solution
  • ๐Ÿง  Approach / Explanation (when helpful)
  • โฑ Time & space complexity
  • ๐Ÿ”— Link to original problem

๐Ÿ›  Technologies Used

  • Swift 5+
  • Xcode Playground / Swift files
  • LeetCode problem references

๐Ÿงฉ Problem Format

Each problem typically includes:

  • Problem name
  • Link to the original problem
  • Approach / Explanation
  • Time & Space Complexity
  • Swift Solution

Example: DS

// ๐Ÿ”— Problem: https://leetcode.com/problems/two-sum/
// ๐Ÿง  Approach: HashMap to store visited numbers and their indices
// โฐ Time: O(n)
// ๐Ÿ’พ Space: O(n)

func twoSum(_ nums: [Int], _ target: Int) -> [Int] {
    var map = [Int: Int]()
    for (i, num) in nums.enumerated() {
        if let j = map[target - num] {
            return [j, i]
        }
        map[num] = i
    }
    return []
}

About

๐Ÿ’ป A collection of Swift implementations for DSA problems, organized by topic. Clean code, clear logic, and plenty of practice โ€” for anyone learning DSA in Swift.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages