Solutions to LeetCode by Swift.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LeetCode.swift
.gitignore
LICENSE
README.md

README.md

LeetCode.swift

Solutions to LeetCode by Swift.

Tags Abbreviated description

  • A : Array
  • DP : Dynamic Programming
  • Str : String
  • M : Math
  • T : Tree
  • HT : Hash Table
  • DS : Depth-first Search
  • BS : Binary Search
  • TP : Two Pointers
  • B : Backtracking
  • LL : Linked List
  • D&C : Divide and Conquer
  • H : Heap
  • S : Sort

How to debug

The main.swift is to initialized Solution.func(val), then you can debug. Be sure when you initialize the Solution's swift file has chosen Target Membership, like the following image. And once time you just choose one Solution's swift file!

Solution Analysis

You can find all solution analysis in my blog LeetCode OJ, and the analysis to each problem is in the mext table blog.

Problems

# Title Solution Difficulty Tags Blog
1 Two Sum Solution A HT blog
2 Add Two Numbers Solution LL M blog
3 Longest Substring Without Repeating Characters Solution HT TP Str blog
4 Median of Two Sorted Arrays Solution A BS D&C -
12 Integer to Roman Solution M A blog
13 Roman to Integer Solution M A blog
21 Merge Two Sorted Lists Solution LL blog
28 Implement strStr() Solution TP Str blog
53 Maximum Subarray Solution A D&C DP blog
66 Plus One Solution A M blog
108 Convert Sorted Array to Binary Search Tree Solution T DS blog
139 Word Break Solution DP blog
140 Word Break II Solution DP B blog
164 Maximum Gap Solution S blog
206 Reverse Linked List Solution LL blog
283 Move Zeroes Solution A TP blog
373 Find K Pairs with Smallest Sums Solution H blog
628 Maximum Product of Three Numbers Solution A M blog