From a72988e1e23c344d1730917aed0476ae7e0055fa Mon Sep 17 00:00:00 2001 From: Lanre Adedara Date: Tue, 28 May 2024 12:53:15 +0100 Subject: [PATCH] feat: add swift implementation to lcof problem: No.48 (#2933) --- .../README.md | 24 +++++++++++++++++++ .../Solution.swift | 19 +++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 lcof/面试题48. 最长不含重复字符的子字符串/Solution.swift diff --git a/lcof/面试题48. 最长不含重复字符的子字符串/README.md b/lcof/面试题48. 最长不含重复字符的子字符串/README.md index 4103da44fe..324c303bc6 100644 --- a/lcof/面试题48. 最长不含重复字符的子字符串/README.md +++ b/lcof/面试题48. 最长不含重复字符的子字符串/README.md @@ -220,6 +220,30 @@ public class Solution { } ``` +#### Swift + +```swift +class Solution { + func lengthOfLongestSubstring(_ s: String) -> Int { + var ans = 0 + var j = 0 + var vis = Set() + let sArray = Array(s) + + for i in 0.. diff --git a/lcof/面试题48. 最长不含重复字符的子字符串/Solution.swift b/lcof/面试题48. 最长不含重复字符的子字符串/Solution.swift new file mode 100644 index 0000000000..8656662fcf --- /dev/null +++ b/lcof/面试题48. 最长不含重复字符的子字符串/Solution.swift @@ -0,0 +1,19 @@ +class Solution { + func lengthOfLongestSubstring(_ s: String) -> Int { + var ans = 0 + var j = 0 + var vis = Set() + let sArray = Array(s) + + for i in 0..