Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/huangrunhua/leetcode-swift
Swift Solution for LeetCode | LeetCode Swift 题解
https://github.com/huangrunhua/leetcode-swift
coding-challenges coding-interviews leetcode leetcode-solutions leetcode-swift swift
Last synced: 28 days ago
JSON representation
Swift Solution for LeetCode | LeetCode Swift 题解
- Host: GitHub
- URL: https://github.com/huangrunhua/leetcode-swift
- Owner: HuangRunHua
- Created: 2023-05-22T08:12:24.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-16T04:16:14.000Z (about 1 year ago)
- Last Synced: 2024-11-09T14:16:31.997Z (3 months ago)
- Topics: coding-challenges, coding-interviews, leetcode, leetcode-solutions, leetcode-swift, swift
- Language: Swift
- Homepage:
- Size: 4.79 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Swift Solution for LeetCode Coding Interviews
### 字符串#### 简单
[剑指 Offer 05. 替换空格](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer05-替换空格.playground/Contents.swift)
[剑指 Offer 58 - II. 左旋转字符串](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer58-II-左旋转字符串.playground/Contents.swift)
#### 中等
[剑指 Offer 20. 表示数值的字符串](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer20-表示数值的字符串.playground/Contents.swift)
[剑指 Offer 20. 表示数值的字符串 (解法2: 更通俗易懂的有限状态自由机)](https://github.com/HuangRunHua/leetcode-swift/blob/main/剑指Offer/剑指Offer20-表示数值的字符串解法二.playground/Contents.swift)
[剑指 Offer 67. 把字符串转换成整数](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer67-把字符串转换成整数.playground/Contents.swift)
[剑指 Offer 67. 把字符串转换成整数 (解法2: 有限状态自由机)](https://github.com/HuangRunHua/leetcode-swift/blob/main/剑指Offer/剑指Offer67-把字符串转换成整数解法2.playground/Contents.swift)
### 链表
#### 简单
[剑指 Offer 06. 从尾到头打印链表](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer06-从尾到头打印链表.playground/Contents.swift)
[剑指 Offer 24. 反转链表](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer24-反转链表.playground/Contents.swift)
#### 中等
[剑指 Offer 35. 复杂链表的复制](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer35-复杂链表的复制.playground/Contents.swift)
### 双指针
#### 简单
[剑指 Offer 18. 删除链表的节点](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer18-删除链表的节点.playground/Contents.swift)
[剑指 Offer 22. 链表中倒数第k个节点](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer22-链表中倒数第k个节点.playground/Contents.swift)
[剑指 Offer 25. 合并两个排序的链表](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer25-合并两个排序的链表.playground/Contents.swift)
[剑指 Offer 52. 两个链表的第一个公共节点](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer52-两个链表的第一个公共节点.playground/Contents.swift)
[剑指 Offer 21. 调整数组顺序使奇数位于偶数前面](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer21调整数组顺序使奇数位于偶数前面.playground/Contents.swift)
[剑指 Offer 57. 和为s的两个数字](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer57-和为s的两个数字.playground/Contents.swift)
[剑指 Offer 58 - I. 翻转单词顺序](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer58-I-翻转单词顺序.playground/Contents.swift)
### 栈与队列
#### 简单
[剑指 Offer 09. 用两个栈实现队列](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer09-用两个栈实现队列.playground/Contents.swift)
[剑指 Offer 30. 包含min函数的栈](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer30-包含min函数的栈.playground/Contents.swift)
#### 中等
[剑指 Offer 59 - II. 队列的最大值](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer59-II-队列的最大值.playground/Contents.swift)
#### 困难
[剑指 Offer 59 - I. 滑动窗口的最大值](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer59-I-滑动窗口的最大值.playground/Contents.swift)
### 模拟
#### 简单
[剑指 Offer 29. 顺时针打印矩阵](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer29-顺时针打印矩阵.playground/Contents.swift)
#### 中等
[剑指 Offer 31. 栈的压入、弹出序列](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer31-栈的压入弹出序列.playground/Contents.swift)
### 查找算法
#### 简单
[剑指 Offer 03. 数组中重复的数字](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer03-数组中重复的数字.playground/Contents.swift)
[剑指 Offer 53 - I. 在排序数组中查找数字 I](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer53-I-在排序数组中查找数字%20I.playground/Contents.swift)
[剑指 Offer 53 - II. 0~n-1中缺失的数字](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer53-II0-n-1中缺失的数字.playground/Contents.swift)
[剑指 Offer 11. 旋转数组的最小数字](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer11-旋转数组的最小数字%20.playground/Contents.swift)
[剑指 Offer 50. 第一个只出现一次的字符](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer50-第一个只出现一次的字符.playground/Contents.swift)
#### 中等
[剑指 Offer 04. 二维数组中的查找](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer04-二维数组中的查找.playground/Contents.swift)
### 搜索与回溯算法
#### 简单
[剑指 Offer 32 - II. 从上到下打印二叉树 II](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer32-II-从上到下打印二叉树%20II.playground/Contents.swift)
[剑指 Offer 27. 二叉树的镜像](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer27-二叉树的镜像.playground/Contents.swift)
[剑指 Offer 28. 对称的二叉树](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer28-对称的二叉树.playground/Contents.swift)
[剑指 Offer 54. 二叉搜索树的第k大节点](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer54-二叉搜索树的第k大节点.playground/Contents.swift)
[剑指 Offer 55 - I. 二叉树的深度](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer55-I-二叉树的深度.playground/Contents.swift)
[剑指 Offer 55 - II. 平衡二叉树](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer55-II-平衡二叉树.playground/Contents.swift)
[剑指 Offer 68 - I. 二叉搜索树的最近公共祖先](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer68-I二叉搜索树的最近公共祖先.playground/Contents.swift)
[剑指 Offer 68 - II. 二叉树的最近公共祖先](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer68-II-二叉树的最近公共祖先.playground/Contents.swift)
#### 中等
[剑指 Offer 32 - I. 从上到下打印二叉树](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer32-I-从上到下打印二叉树.playground/Contents.swift)
[剑指 Offer 32 - III. 从上到下打印二叉树 III](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer32-III-从上到下打印二叉树%20III.playground/Contents.swift)
[剑指 Offer 26. 树的子结构](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer26-树的子结构.playground/Contents.swift)
[剑指 Offer 12. 矩阵中的路径](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer12-矩阵中的路径.playground/Contents.swift)
[剑指 Offer 13. 机器人的运动范围](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer13-机器人的运动范围.playground/Contents.swift)
[剑指 Offer 34. 二叉树中和为某一值的路径](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer34-二叉树中和为某一值的路径.playground/Contents.swift)
[剑指 Offer 36. 二叉搜索树与双向链表](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer36-二叉搜索树与双向链表.playground/Contents.swift)
[剑指 Offer 64. 求1+2+…+n](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer64-求1%2B2%2B…%2Bn.playground/Contents.swift)
[剑指 Offer 38. 字符串的排列 (解法1)](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer38-字符串的排列.playground/Contents.swift)
[剑指 Offer 38. 字符串的排列 (解法2)](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer38-字符串的排列解法2.playground/Contents.swift)
#### 困难
[剑指 Offer 37. 序列化二叉树](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer37-序列化二叉树.playground/Contents.swift)
### 分治算法
#### 简单
[剑指 Offer 17. 打印从1到最大的n位数](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer17-打印从1到最大的n位数.playground/Contents.swift)
#### 中等
[剑指 Offer 07. 重建二叉树](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer07-重建二叉树.playground/Contents.swift)
[剑指 Offer 16. 数值的整数次方](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer16-数值的整数次方.playground/Contents.swift)
[剑指 Offer 33. 二叉搜索树的后序遍历序列](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer33-二叉搜索树的后序遍历序列.playground/Contents.swift)
#### 困难
[剑指 Offer 51. 数组中的逆序对](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer51-数组中的逆序对.playground/Contents.swift)
### 排序
#### 简单
[剑指 Offer 61. 扑克牌中的顺子](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer61-扑克牌中的顺子.playground/Contents.swift)
[剑指 Offer 40. 最小的k个数](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer40-最小的k个数.playground/Contents.swift)
#### 中等
[剑指 Offer 45. 把数组排成最小的数](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer45-把数组排成最小的数.playground/Contents.swift)
#### 困难
[剑指 Offer 41. 数据流中的中位数](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer41-数据流中的中位数.playground/Contents.swift)
### 动态规划
#### 简单
[剑指 Offer 10- I. 斐波那契数列](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer10-I-斐波那契数列.playground/Contents.swift)
[剑指 Offer 10- II. 青蛙跳台阶问题](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer10-II-青蛙跳台阶问题.playground/Contents.swift)
[剑指 Offer 42. 连续子数组的最大和](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer42-连续子数组的最大和.playground/Contents.swift)
[剑指 Offer 42. 连续子数组的最大和(模板套路解法)](https://github.com/HuangRunHua/leetcode-swift/blob/main/剑指Offer/剑指Offer42-连续子数组的最大和(解法2).playground/Contents.swift)
#### 中等
[剑指 Offer 63. 股票的最大利润](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer63-股票的最大利润.playground/Contents.swift)
[剑指 Offer 47. 礼物的最大价值](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer47-礼物的最大价值.playground/Contents.swift)
[剑指 Offer 46. 把数字翻译成字符串](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer46-把数字翻译成字符串.playground/Contents.swift)
[剑指 Offer 48. 最长不含重复字符的子字符串](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer48-最长不含重复字符的子字符串.playground/Contents.swift)
[剑指 Offer 49. 丑数](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer49-丑数.playground/Contents.swift)
[剑指 Offer 60. n个骰子的点数](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer60-n个骰子的点数.playground/Contents.swift)
#### 困难
[剑指 Offer 19. 正则表达式匹配](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer19-正则表达式匹配.playground/Contents.swift)
[剑指 Offer 19. 正则表达式匹配解法2](https://github.com/HuangRunHua/leetcode-swift/blob/main/剑指Offer/剑指Offer19.正则表达式匹配解法2.playground/Contents.swift)
### 位运算
#### 简单
[剑指 Offer 15. 二进制中1的个数](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer15-二进制中1的个数.playground/Contents.swift)
[剑指 Offer 65. 不用加减乘除做加法](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer65-不用加减乘除做加法.playground/Contents.swift)
#### 中等
[剑指 Offer 56 - I. 数组中数字出现的次数](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer56-I-数组中数字出现的次数.playground/Contents.swift)
[剑指 Offer 56 - II. 数组中数字出现的次数 II](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer56-II-数组中数字出现的次数%20II.playground/Contents.swift)
### 数学
#### 简单
[剑指 Offer 39. 数组中出现次数超过一半的数字](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer39-数组中出现次数超过一半的数字.playground/Contents.swift)
[剑指 Offer 57 - II. 和为s的连续正数序列](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer57II-和为s的连续正数序列.playground/Contents.swift)
[剑指 Offer 62. 圆圈中最后剩下的数字](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer62-圆圈中最后剩下的数字.playground/Contents.swift)
#### 中等
[剑指 Offer 66. 构建乘积数组](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer66-构建乘积数组.playground/Contents.swift)
[剑指 Offer 14- I. 剪绳子](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer14-I-剪绳子.playground/Contents.swift)
[剑指 Offer 14- II. 剪绳子 II](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer14-II-剪绳子%20II.playground/Contents.swift)
[剑指 Offer 44. 数字序列中某一位的数字](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer44-数字序列中某一位的数字.playground/Contents.swift)
#### 困难
[剑指 Offer 43. 1~n 整数中 1 出现的次数](https://github.com/HuangRunHua/leetcode-swift/tree/main/剑指Offer/剑指Offer43-1~n整数中1出现的次数.playground/Contents.swift)